AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Unit Class Referenceabstract

#include "Unit.h"

Inheritance diagram for Unit:
WorldObject Object WorldLocation Position Creature Player TempSummon Minion Guardian Puppet Totem Pet

Public Types

typedef std::unordered_set< Unit * > AttackerSet
 
typedef std::set< Unit * > ControlSet
 
typedef std::multimap< uint32, Aura * > AuraMap
 
typedef std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
 
typedef std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
 
typedef std::multimap< uint32, AuraApplication * > AuraApplicationMap
 
typedef std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
 
typedef std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
 
typedef std::multimap< AuraStateType, AuraApplication * > AuraStateAurasMap
 
typedef std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
 
typedef std::list< AuraEffect * > AuraEffectList
 
typedef std::list< Aura * > AuraList
 
typedef std::list< AuraApplication * > AuraApplicationList
 
typedef std::list< DiminishingReturnDiminishing
 
typedef GuidUnorderedSet ComboPointHolderSet
 
typedef std::map< uint8, AuraApplication * > VisibleAuraMap
 
typedef std::set< PetAura const * > PetAuraSet
 

Public Member Functions

 ~Unit () override
 
UnitAIGetAI ()
 
void SetAI (UnitAI *newAI)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void CleanupBeforeRemoveFromMap (bool finalCleanup)
 
void CleanupsBeforeDelete (bool finalCleanup=true) override
 
uint32 GetDynamicFlags () const override
 
void ReplaceAllDynamicFlags (uint32 flag) override
 
DiminishingLevels GetDiminishing (DiminishingGroup group)
 
void IncrDiminishing (DiminishingGroup group)
 
float ApplyDiminishingToDuration (DiminishingGroup group, int32 &duration, Unit *caster, DiminishingLevels Level, int32 limitduration)
 
void ApplyDiminishingAura (DiminishingGroup group, bool apply)
 
void ClearDiminishings ()
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
void Update (uint32 time) override
 
void setAttackTimer (WeaponAttackType type, int32 time)
 
void resetAttackTimer (WeaponAttackType type=BASE_ATTACK)
 
int32 getAttackTimer (WeaponAttackType type) const
 
bool isAttackReady (WeaponAttackType type=BASE_ATTACK) const
 
bool haveOffhandWeapon () const
 
bool CanDualWield () const
 
virtual void SetCanDualWield (bool value)
 
float GetCombatReach () const override
 
float GetMeleeReach () const
 
bool IsWithinRange (Unit const *obj, float dist) const
 
bool IsWithinCombatRange (Unit const *obj, float dist2compare) const
 
bool IsWithinMeleeRange (Unit const *obj, float dist=0.f) const
 
float GetMeleeRange (Unit const *target) const
 
virtual SpellSchoolMask GetMeleeDamageSchoolMask (WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
 
bool GetRandomContactPoint (Unit const *target, float &x, float &y, float &z, bool force=false) const
 
void _addAttacker (Unit *pAttacker)
 
void _removeAttacker (Unit *pAttacker)
 
UnitgetAttackerForHelper () const
 
bool Attack (Unit *victim, bool meleeAttack)
 
void CastStop (uint32 except_spellid=0, bool withInstant=true)
 Interrupt the unit cast for all the current spells. More...
 
bool AttackStop ()
 Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client. More...
 
void RemoveAllAttackers ()
 Remove all units in m_attackers list and send them AttackStop() More...
 
AttackerSet const & getAttackers () const
 
bool GetMeleeAttackPoint (Unit *attacker, Position &pos)
 
bool isAttackingPlayer () const
 
UnitGetVictim () const
 
void CombatStop (bool includingCast=false)
 
void CombatStopWithPets (bool includingCast=false)
 
void StopAttackFaction (uint32 faction_id)
 
void StopAttackingInvalidTarget ()
 
UnitSelectNearbyTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
UnitSelectNearbyNoTotemTarget (Unit *exclude=nullptr, float dist=NOMINAL_MELEE_RANGE) const
 
void SendMeleeAttackStop (Unit *victim=nullptr)
 Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead. More...
 
void SendMeleeAttackStart (Unit *victim, Player *sendTo=nullptr)
 
void AddUnitState (uint32 f)
 
bool HasUnitState (const uint32 f) const
 
void ClearUnitState (uint32 f)
 
uint32 GetUnitState () const
 
bool CanFreeMove () const
 
uint32 HasUnitTypeMask (uint32 mask) const
 
void AddUnitTypeMask (uint32 mask)
 
uint32 GetUnitTypeMask () const
 
bool IsSummon () const
 
bool IsGuardian () const
 
bool IsControllableGuardian () const
 
bool IsPet () const
 
bool IsHunterPet () const
 
bool IsTotem () const
 
bool IsVehicle () const
 
uint8 GetLevel () const
 
uint8 getLevelForTarget (WorldObject const *) const override
 
void SetLevel (uint8 lvl, bool showLevelChange=true)
 
uint8 getRace (bool original=false) const
 
void setRace (uint8 race)
 
uint32 getRaceMask () const
 
uint8 getClass () const
 
virtual bool IsClass (Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
 
uint32 getClassMask () const
 
uint8 getGender () const
 
DisplayRace GetDisplayRaceFromModelId (uint32 modelId) const
 
DisplayRace GetDisplayRace () const
 
float GetStat (Stats stat) const
 
void SetStat (Stats stat, int32 val)
 
uint32 GetArmor () const
 
void SetArmor (int32 val)
 
uint32 GetResistance (SpellSchools school) const
 
uint32 GetResistance (SpellSchoolMask mask) const
 
void SetResistance (SpellSchools school, int32 val)
 
uint32 GetHealth () const
 
uint32 GetMaxHealth () const
 
bool IsFullHealth () const
 
bool HealthBelowPct (int32 pct) const
 
bool HealthBelowPctDamaged (int32 pct, uint32 damage) const
 
bool HealthAbovePct (int32 pct) const
 
bool HealthAbovePctHealed (int32 pct, uint32 heal) const
 
float GetHealthPct () const
 
uint32 CountPctFromMaxHealth (int32 pct) const
 
uint32 CountPctFromCurHealth (int32 pct) const
 
float GetPowerPct (Powers power) const
 
void SetHealth (uint32 val)
 
void SetMaxHealth (uint32 val)
 
void SetFullHealth ()
 
int32 ModifyHealth (int32 val)
 
int32 GetHealthGain (int32 dVal)
 
Powers getPowerType () const
 
void setPowerType (Powers power)
 
virtual bool HasActivePowerType (Powers power)
 
uint32 GetPower (Powers power) const
 
uint32 GetMaxPower (Powers power) const
 
void SetPower (Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
 
void SetMaxPower (Powers power, uint32 val)
 
int32 ModifyPower (Powers power, int32 val, bool withPowerUpdate=true)
 
int32 ModifyPowerPct (Powers power, float pct, bool apply=true)
 
uint32 GetAttackTime (WeaponAttackType att) const
 
void SetAttackTime (WeaponAttackType att, uint32 val)
 
void ApplyAttackTimePercentMod (WeaponAttackType att, float val, bool apply)
 
void ApplyCastTimePercentMod (float val, bool apply)
 
void SetUInt32Value (uint16 index, uint32 value)
 
UnitFlags GetUnitFlags () const
 
bool HasUnitFlag (UnitFlags flags) const
 
void SetUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h. More...
 
void RemoveUnitFlag (UnitFlags flags)
 UnitFlags available in UnitDefines.h. More...
 
void ReplaceAllUnitFlags (UnitFlags flags)
 Remove the Unit flag specify only. More...
 
UnitFlags2 GetUnitFlags2 () const
 Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h. More...
 
bool HasUnitFlag2 (UnitFlags2 flags) const
 
void SetUnitFlag2 (UnitFlags2 flags)
 
void RemoveUnitFlag2 (UnitFlags2 flags)
 
void ReplaceAllUnitFlags2 (UnitFlags2 flags)
 
SheathState GetSheath () const
 
virtual void SetSheath (SheathState sheathed)
 
uint32 GetFaction () const
 
void SetFaction (uint32 faction)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (Unit const *target, bool checkOriginalFaction=false) const
 
ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
 
bool IsHostileTo (Unit const *unit) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (Unit const *unit) const
 
bool IsNeutralToAll () const
 
bool IsInPartyWith (Unit const *unit) const
 
bool IsInRaidWith (Unit const *unit) const
 
void GetPartyMembers (std::list< Unit * > &units)
 
bool IsContestedGuard () const
 
bool IsInSanctuary () const
 
bool IsPvP () const
 
bool IsFFAPvP () const
 
void SetPvP (bool state)
 
uint32 GetCreatureType () const
 
uint32 GetCreatureTypeMask () const
 
uint8 getStandState () const
 
bool IsSitState () const
 
bool IsStandState () const
 
void SetStandState (uint8 state)
 
void SetStandFlags (uint8 flags)
 
void RemoveStandFlags (uint8 flags)
 
bool IsMounted () const
 
uint32 GetMountID () const
 
void Mount (uint32 mount, uint32 vehicleId=0, uint32 creatureEntry=0)
 
void Dismount ()
 
uint16 GetMaxSkillValueForLevel (Unit const *target=nullptr) const
 
void KillSelf (bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
void ProcDamageAndSpellFor (bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
void GetProcAurasTriggeredOnEvent (std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
 
void TriggerAurasProcOnEvent (CalcDamageInfo &damageInfo)
 
void TriggerAurasProcOnEvent (std::list< AuraApplication * > *myProcAuras, std::list< AuraApplication * > *targetProcAuras, Unit *actionTarget, uint32 typeMaskActor, uint32 typeMaskActionTarget, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
 
void TriggerAurasProcOnEvent (ProcEventInfo &eventInfo, std::list< AuraApplication * > &procAuras)
 
void HandleEmoteCommand (uint32 emoteId)
 
void AttackerStateUpdate (Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
 
void CalculateMeleeDamage (Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
 
void DealMeleeDamage (CalcDamageInfo *damageInfo, bool durabilityLoss)
 
void HandleProcExtraAttackFor (Unit *victim, uint32 count)
 
void SetLastExtraAttackSpell (uint32 spellId)
 
uint32 GetLastExtraAttackSpell () const
 
void AddExtraAttacks (uint32 count)
 
void SetLastDamagedTargetGuid (ObjectGuid const &guid)
 
ObjectGuid const & GetLastDamagedTargetGuid () const
 
void CalculateSpellDamageTaken (SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=BASE_ATTACK, bool crit=false)
 
void DealSpellDamage (SpellNonMeleeDamage *damageInfo, bool durabilityLoss, Spell const *spell=nullptr)
 
float GetMeleeCritChanceReduction () const
 
float GetRangedCritChanceReduction () const
 
float GetSpellCritChanceReduction () const
 
uint32 GetMeleeCritDamageReduction (uint32 damage) const
 
uint32 GetRangedCritDamageReduction (uint32 damage) const
 
uint32 GetSpellCritDamageReduction (uint32 damage) const
 
uint32 GetMeleeDamageReduction (uint32 damage) const
 
uint32 GetRangedDamageReduction (uint32 damage) const
 
uint32 GetSpellDamageReduction (uint32 damage) const
 
float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
 
SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spell)
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spell, bool canReflect=false)
 
SpellMissInfo SpellHitResult (Unit *victim, Spell const *spell, bool canReflect=false)
 
float GetUnitDodgeChance () const
 
float GetUnitParryChance () const
 
float GetUnitBlockChance () const
 
float GetUnitMissChance (WeaponAttackType attType) const
 
float GetUnitCriticalChance (WeaponAttackType attackType, Unit const *victim) const
 
int32 GetMechanicResistChance (SpellInfo const *spell)
 
bool CanUseAttackType (uint8 attacktype) const
 
virtual uint32 GetShieldBlockValue () const =0
 
uint32 GetShieldBlockValue (uint32 soft_cap, uint32 hard_cap) const
 
uint32 GetUnitMeleeSkill (Unit const *target=nullptr) const
 
uint32 GetDefenseSkillValue (Unit const *target=nullptr) const
 
uint32 GetWeaponSkillValue (WeaponAttackType attType, Unit const *target=nullptr) const
 
float GetWeaponProcChance () const
 
float GetPPMProcChance (uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType) const
 
MeleeHitOutcome RollMeleeOutcomeAgainst (Unit const *victim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const
 
NPCFlags GetNpcFlags () const
 
bool HasNpcFlag (NPCFlags flags) const
 
void SetNpcFlag (NPCFlags flags)
 
void RemoveNpcFlag (NPCFlags flags)
 
void ReplaceAllNpcFlags (NPCFlags flags)
 
bool IsVendor () const
 
bool IsTrainer () const
 
bool IsQuestGiver () const
 
bool IsGossip () const
 
bool IsTaxi () const
 
bool IsGuildMaster () const
 
bool IsBattleMaster () const
 
bool IsBanker () const
 
bool IsInnkeeper () const
 
bool IsSpiritHealer () const
 
bool IsSpiritGuide () const
 
bool IsTabardDesigner () const
 
bool IsAuctioner () const
 
bool IsArmorer () const
 
bool IsServiceProvider () const
 
bool IsSpiritService () const
 
bool IsCritter () const
 
bool IsInFlight () const
 
void SetImmuneToAll (bool apply, bool keepCombat=false)
 
bool IsImmuneToAll () const
 
void SetImmuneToPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToPC () const
 
void SetImmuneToNPC (bool apply, bool keepCombat=false)
 
bool IsImmuneToNPC () const
 
bool IsEngaged () const
 
bool IsEngagedBy (Unit const *who) const
 
bool IsInCombat () const
 
bool IsInCombatWith (Unit const *who) const
 
bool IsPetInCombat () const
 
void CombatStart (Unit *target, bool initialAggro=true)
 
void CombatStartOnCast (Unit *target, bool initialAggro=true, uint32 duration=0)
 
void SetInCombatState (bool PvP, Unit *enemy=nullptr, uint32 duration=0)
 
void SetInCombatWith (Unit *enemy, uint32 duration=0)
 
void ClearInCombat ()
 
void ClearInPetCombat ()
 
uint32 GetCombatTimer () const
 
void SetCombatTimer (uint32 timer)
 
bool HasAuraTypeWithFamilyFlags (AuraType auraType, uint32 familyName, uint32 familyFlags) const
 
virtual bool HasSpell (uint32) const
 
bool HasBreakableByDamageAuraType (AuraType type, uint32 excludeAura=0) const
 
bool HasBreakableByDamageCrowdControlAura (Unit *excludeCasterChannel=nullptr) const
 
bool HasStealthAura () const
 
bool HasInvisibilityAura () const
 
bool isFeared () const
 
bool isInRoots () const
 
bool IsPolymorphed () const
 
bool isFrozen () const
 
bool isTargetableForAttack (bool checkFakeDeath=true, Unit const *byWho=nullptr) const
 
bool IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell=nullptr) const
 
bool _IsValidAttackTarget (Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
 
bool IsValidAssistTarget (Unit const *target) const
 
bool _IsValidAssistTarget (Unit const *target, SpellInfo const *bySpell) const
 
virtual bool IsInWater () const
 
virtual bool IsUnderWater () const
 
bool isInAccessiblePlaceFor (Creature const *c) const
 
void SendHealSpellLog (HealInfo const &healInfo, bool critical=false)
 
int32 HealBySpell (HealInfo &healInfo, bool critical=false)
 
void SendEnergizeSpellLog (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
void EnergizeBySpell (Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
 
SpellCastResult CastSpell (SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, uint32 spellId, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (Unit *victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (float x, float y, float z, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastSpell (GameObject *go, uint32 spellId, bool triggered, Item *castItem=nullptr, AuraEffect *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, SpellValueMod mod, int32 value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
SpellCastResult CastCustomSpell (uint32 spellId, CustomSpellValues const &value, Unit *victim=nullptr, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
 
AuraAddAura (uint32 spellId, Unit *target)
 
AuraAddAura (SpellInfo const *spellInfo, uint8 effMask, Unit *target)
 
void SetAuraStack (uint32 spellId, Unit *target, uint32 stack)
 
void SendPlaySpellVisual (uint32 id)
 
void SendPlaySpellImpact (ObjectGuid guid, uint32 id)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, uint32 spellId, uint32 cooldown)
 
void BuildCooldownPacket (WorldPacket &data, uint8 flags, PacketCooldowns const &cooldowns)
 
void DeMorph ()
 
void SendAttackStateUpdate (CalcDamageInfo *damageInfo)
 
void SendAttackStateUpdate (uint32 HitInfo, Unit *target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount)
 
void SendSpellNonMeleeDamageLog (SpellNonMeleeDamage *log)
 
void SendSpellNonMeleeReflectLog (SpellNonMeleeDamage *log, Unit *attacker)
 
void SendSpellNonMeleeDamageLog (Unit *target, SpellInfo const *spellInfo, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit=false, bool Split=false)
 
void SendPeriodicAuraLog (SpellPeriodicAuraLogInfo *pInfo)
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
void SendSpellDamageResist (Unit *target, uint32 spellId)
 
void SendSpellDamageImmune (Unit *target, uint32 spellId)
 
void NearTeleportTo (Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void NearTeleportTo (float x, float y, float z, float orientation, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
 
void SendTameFailure (uint8 result)
 
void SendTeleportPacket (Position &pos)
 
virtual bool UpdatePosition (float x, float y, float z, float ang, bool teleport=false)
 
bool UpdatePosition (const Position &pos, bool teleport=false)
 
void UpdateOrientation (float orientation)
 Only server-side orientation update, does not broadcast to client. More...
 
void UpdateHeight (float newZ)
 Only server-side height update, does not broadcast to client. More...
 
void KnockbackFrom (float x, float y, float speedXY, float speedZ)
 
void JumpTo (float speedXY, float speedZ, bool forward=true)
 
void JumpTo (WorldObject *obj, float speedZ)
 
void SendMonsterMove (float NewPosX, float NewPosY, float NewPosZ, uint32 TransitTime, SplineFlags sf=SPLINEFLAG_WALK_MODE)
 
void MonsterMoveWithSpeed (float x, float y, float z, float speed)
 
void SendMovementFlagUpdate (bool self=false)
 
virtual bool SetWalk (bool enable)
 
virtual bool SetDisableGravity (bool disable, bool packetOnly=false, bool updateAnimationTier=true)
 
virtual bool SetSwim (bool enable)
 
virtual bool SetCanFly (bool enable, bool packetOnly=false)
 Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity(). More...
 
virtual bool SetWaterWalking (bool enable, bool packetOnly=false)
 Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players. More...
 
virtual bool SetFeatherFall (bool enable, bool packetOnly=false)
 
virtual bool SetHover (bool enable, bool packetOnly=false, bool updateAnimationTier=true)
 
void SendMovementWaterWalking (Player *sendTo)
 
void SendMovementFeatherFall (Player *sendTo)
 
void SendMovementHover (Player *sendTo)
 
void SetInFront (WorldObject const *target)
 
void SetFacingTo (float ori)
 
void SetFacingToObject (WorldObject *object)
 
void SendChangeCurrentVictimOpcode (HostileReference *pHostileReference)
 
void SendClearThreatListOpcode ()
 
void SendRemoveFromThreatListOpcode (HostileReference *pHostileReference)
 
void SendThreatListUpdate ()
 
void SendClearTarget ()
 
void BuildHeartBeatMsg (WorldPacket *data) const
 
bool IsAlive () const
 
bool isDying () const
 
bool isDead () const
 
DeathState getDeathState ()
 
virtual void setDeathState (DeathState s, bool despawn=false)
 
ObjectGuid GetOwnerGUID () const
 
void SetOwnerGUID (ObjectGuid owner)
 
ObjectGuid GetCreatorGUID () const
 
void SetCreatorGUID (ObjectGuid creator)
 
ObjectGuid GetMinionGUID () const
 
void SetMinionGUID (ObjectGuid guid)
 
ObjectGuid GetCharmerGUID () const
 
void SetCharmerGUID (ObjectGuid owner)
 
ObjectGuid GetCharmGUID () const
 
void SetPetGUID (ObjectGuid guid)
 
ObjectGuid GetPetGUID () const
 
void SetCritterGUID (ObjectGuid guid)
 
ObjectGuid GetCritterGUID () const
 
bool IsControlledByPlayer () const
 
bool IsCreatedByPlayer () const
 
ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
bool IsCharmedOwnedByPlayerOrPlayer () const
 
PlayerGetSpellModOwner () const
 
UnitGetOwner () const
 
GuardianGetGuardianPet () const
 
MinionGetFirstMinion () const
 
UnitGetCharmer () const
 
UnitGetCharm () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
void SetMinion (Minion *minion, bool apply)
 
void GetAllMinionsByEntry (std::list< Creature * > &Minions, uint32 entry)
 
void RemoveAllMinionsByEntry (uint32 entry)
 
void SetCharm (Unit *target, bool apply)
 
UnitGetNextRandomRaidMemberOrPet (float radius)
 
bool SetCharmedBy (Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
 
void RemoveCharmedBy (Unit *charmer)
 
void RestoreFaction ()
 
UnitGetFirstControlled () const
 
void RemoveAllControlled (bool onDeath=false)
 
bool IsCharmed () const
 
bool isPossessed () const
 
bool isPossessedByPlayer () const
 
bool isPossessing () const
 
bool isPossessing (Unit *u) const
 
CharmInfoGetCharmInfo ()
 
CharmInfoInitCharmInfo ()
 
void DeleteCharmInfo ()
 
void UpdateCharmAI ()
 
SharedVisionList const & GetSharedVisionList ()
 
void AddPlayerToVision (Player *player)
 
void RemovePlayerFromVision (Player *player)
 
bool HasSharedVision () const
 
void RemoveBindSightAuras ()
 
void RemoveCharmAuras ()
 
PetCreateTamedPetFrom (Creature *creatureTarget, uint32 spell_id=0)
 
PetCreateTamedPetFrom (uint32 creatureEntry, uint32 spell_id=0)
 
bool InitTamedPet (Pet *pet, uint8 level, uint32 spell_id)
 
Aura_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint8 effMask, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool periodicReset=false)
 
void _AddAura (UnitAura *aura, Unit *caster)
 
AuraApplication_CreateAuraApplication (Aura *aura, uint8 effMask)
 
void _ApplyAuraEffect (Aura *aura, uint8 effIndex)
 
void _ApplyAura (AuraApplication *aurApp, uint8 effMask)
 
void _UnapplyAura (AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
 
void _UnapplyAura (AuraApplication *aurApp, AuraRemoveMode removeMode)
 
void _RemoveNoStackAuraApplicationsDueToAura (Aura *aura)
 
void _RemoveNoStackAurasDueToAura (Aura *aura)
 
bool _IsNoStackAuraDueToAura (Aura *appliedAura, Aura *existingAura) const
 
void _RegisterAuraEffect (AuraEffect *aurEff, bool apply)
 
AuraMapGetOwnedAuras ()
 
AuraMap const & GetOwnedAuras () const
 
void RemoveOwnedAura (AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveOwnedAura (Aura *aura, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
AuraGetOwnedAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
 
AuraApplicationMapGetAppliedAuras ()
 
AuraApplicationMap const & GetAppliedAuras () const
 
void RemoveAura (AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (AuraApplication *aurApp, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAura (Aura *aur, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAppliedAuras (std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (std::function< bool(Aura const *)> const &check)
 
void RemoveAppliedAuras (uint32 spellId, std::function< bool(AuraApplication const *)> const &check)
 
void RemoveOwnedAuras (uint32 spellId, std::function< bool(Aura const *)> const &check)
 
void RemoveAurasDueToSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAuraFromStack (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RemoveAurasDueToSpellByDispel (uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, Unit *dispeller, uint8 chargesRemoved=1)
 
void RemoveAurasDueToSpellBySteal (uint32 spellId, ObjectGuid casterGUID, Unit *stealer)
 
void RemoveAurasDueToItemSpell (uint32 spellId, ObjectGuid castItemGuid)
 
void RemoveAurasByType (AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
 
void RemoveNotOwnSingleTargetAuras ()
 
void RemoveAurasWithInterruptFlags (uint32 flag, uint32 except=0, bool isAutoshot=false)
 
void RemoveAurasWithAttribute (uint32 flags)
 
void RemoveAurasWithFamily (SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID)
 
void RemoveAurasWithMechanic (uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
 
void RemoveMovementImpairingAuras (bool withRoot)
 
void RemoveAurasByShapeShift ()
 
void RemoveAreaAurasDueToLeaveWorld ()
 
void RemoveAllAuras ()
 
void RemoveArenaAuras ()
 
void RemoveAllAurasOnDeath ()
 
void RemoveAllAurasRequiringDeadTarget ()
 
void RemoveAllAurasExceptType (AuraType type)
 
void RemoveEvadeAuras ()
 
void DelayOwnedAuras (uint32 spellId, ObjectGuid caster, int32 delaytime)
 
void _RemoveAllAuraStatMods ()
 
void _ApplyAllAuraStatMods ()
 
AuraEffectList const & GetAuraEffectsByType (AuraType type) const
 
AuraListGetSingleCastAuras ()
 
AuraList const & GetSingleCastAuras () const
 
AuraEffectGetAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectOfRankedSpell (uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraEffectGetAuraEffect (AuraType type, SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, ObjectGuid casterGUID=ObjectGuid::Empty) const
 
AuraEffectGetAuraEffectDummy (uint32 spellid) const
 
AuraEffectGetDummyAuraEffect (SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
 
AuraApplicationGetAuraApplication (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
AuraApplicationGetAuraApplicationOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
 
AuraGetAuraOfRankedSpell (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
void GetDispellableAuraList (Unit *caster, uint32 dispelMask, DispelChargesList &dispelList, SpellInfo const *dispelSpell)
 
bool HasAuraEffect (uint32 spellId, uint8 effIndex, ObjectGuid caster=ObjectGuid::Empty) const
 
uint32 GetAuraCount (uint32 spellId) const
 
bool HasAura (uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
 
bool HasAuraType (AuraType auraType) const
 
bool HasAuraTypeWithCaster (AuraType auratype, ObjectGuid caster) const
 
bool HasAuraTypeWithMiscvalue (AuraType auratype, int32 miscvalue) const
 
bool HasAuraTypeWithAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
bool HasAuraTypeWithValue (AuraType auratype, int32 value) const
 
bool HasAuraTypeWithTriggerSpell (AuraType auratype, uint32 triggerSpell) const
 
bool HasNegativeAuraWithInterruptFlag (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasVisibleAuraType (AuraType auraType) const
 
bool HasNegativeAuraWithAttribute (uint32 flag, ObjectGuid guid=ObjectGuid::Empty)
 
bool HasAuraWithMechanic (uint32 mechanicMask) const
 
AuraEffectIsScriptOverriden (SpellInfo const *spell, int32 script) const
 
uint32 GetDiseasesByCaster (ObjectGuid casterGUID, uint8 mode=0)
 
uint32 GetDoTsByCaster (ObjectGuid casterGUID) const
 
int32 GetTotalAuraModifierAreaExclusive (AuraType auratype) const
 
int32 GetTotalAuraModifier (AuraType auratype) const
 
float GetTotalAuraMultiplier (AuraType auratype) const
 
int32 GetMaxPositiveAuraModifier (AuraType auratype)
 
int32 GetMaxNegativeAuraModifier (AuraType auratype) const
 
int32 GetTotalAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
float GetTotalAuraMultiplierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetMaxPositiveAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
 
int32 GetMaxNegativeAuraModifierByMiscMask (AuraType auratype, uint32 misc_mask) const
 
int32 GetTotalAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
float GetTotalAuraMultiplierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxPositiveAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetMaxNegativeAuraModifierByMiscValue (AuraType auratype, int32 misc_value) const
 
int32 GetTotalAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetTotalAuraMultiplierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxPositiveAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
int32 GetMaxNegativeAuraModifierByAffectMask (AuraType auratype, SpellInfo const *affectedSpell) const
 
float GetResistanceBuffMods (SpellSchools school, bool positive) const
 
void SetResistanceBuffMods (SpellSchools school, bool positive, float val)
 
void ApplyResistanceBuffModsMod (SpellSchools school, bool positive, float val, bool apply)
 
void ApplyResistanceBuffModsPercentMod (SpellSchools school, bool positive, float val, bool apply)
 
void InitStatBuffMods ()
 
void ApplyStatBuffMod (Stats stat, float val, bool apply)
 
void ApplyStatPercentBuffMod (Stats stat, float val, bool apply)
 
void SetCreateStat (Stats stat, float val)
 
void SetCreateHealth (uint32 val)
 
uint32 GetCreateHealth () const
 
void SetCreateMana (uint32 val)
 
uint32 GetCreateMana () const
 
uint32 GetCreatePowers (Powers power) const
 
float GetPosStat (Stats stat) const
 
float GetNegStat (Stats stat) const
 
float GetCreateStat (Stats stat) const
 
void SetCurrentCastedSpell (Spell *pSpell)
 
virtual void ProhibitSpellSchool (SpellSchoolMask, uint32)
 
void InterruptSpell (CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
 
void FinishSpell (CurrentSpellTypes spellType, bool ok=true)
 
bool IsNonMeleeSpellCast (bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
 
void InterruptNonMeleeSpells (bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
 
SpellGetCurrentSpell (CurrentSpellTypes spellType) const
 
SpellGetCurrentSpell (uint32 spellType) const
 
SpellFindCurrentSpellBySpellId (uint32 spell_id) const
 
int32 GetCurrentSpellCastTime (uint32 spell_id) const
 
virtual bool IsMovementPreventedByCasting () const
 
ShapeshiftForm GetShapeshiftForm () const
 
void SetShapeshiftForm (ShapeshiftForm form)
 
bool IsInFeralForm () const
 
bool IsInDisallowedMountForm () const
 
bool HandleStatModifier (UnitMods unitMod, UnitModifierType modifierType, float amount, bool apply)
 
void SetModifierValue (UnitMods unitMod, UnitModifierType modifierType, float value)
 
float GetModifierValue (UnitMods unitMod, UnitModifierType modifierType) const
 
float GetTotalStatValue (Stats stat, float additionalValue=0.0f) const
 
float GetTotalAuraModValue (UnitMods unitMod) const
 
SpellSchools GetSpellSchoolByAuraGroup (UnitMods unitMod) const
 
Stats GetStatByAuraGroup (UnitMods unitMod) const
 
Powers GetPowerTypeByAuraGroup (UnitMods unitMod) const
 
bool CanModifyStats () const
 
void SetCanModifyStats (bool modifyStats)
 
virtual bool UpdateStats (Stats stat)=0
 
virtual bool UpdateAllStats ()=0
 
virtual void UpdateResistances (uint32 school)=0
 
virtual void UpdateAllResistances ()
 
virtual void UpdateArmor ()=0
 
virtual void UpdateMaxHealth ()=0
 
virtual void UpdateMaxPower (Powers power)=0
 
virtual void UpdateAttackPowerAndDamage (bool ranged=false)=0
 
virtual void UpdateDamagePhysical (WeaponAttackType attType)
 
float GetTotalAttackPowerValue (WeaponAttackType attType, Unit *pVictim=nullptr) const
 
float GetWeaponDamageRange (WeaponAttackType attType, WeaponDamageRange type, uint8 damageIndex=0) const
 
void SetBaseWeaponDamage (WeaponAttackType attType, WeaponDamageRange damageRange, float value, uint8 damageIndex=0)
 
virtual void CalculateMinMaxDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0
 
uint32 CalculateDamage (WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
 
float GetAPMultiplier (WeaponAttackType attType, bool normalized)
 
bool isInFrontInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool isInBackInMap (Unit const *target, float distance, float arc=M_PI) const
 
bool IsVisible () const
 
void SetVisible (bool x)
 
void SetModelVisible (bool on)
 
uint32 GetPhaseByAuras () const
 
void SetPhaseMask (uint32 newPhaseMask, bool update) override
 
void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false) override
 
bool CanHaveThreatList () const
 
void AddThreat (Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
 
float ApplyTotalThreatModifier (float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
void TauntApply (Unit *victim)
 
void TauntFadeOut (Unit *taunter)
 
ThreatMgrGetThreatMgr ()
 
ThreatMgr const & GetThreatMgr () const
 
void addHatedBy (HostileReference *pHostileReference)
 
void removeHatedBy (HostileReference *)
 
HostileRefMgrgetHostileRefMgr ()
 
VisibleAuraMap const * GetVisibleAuras ()
 
AuraApplicationGetVisibleAura (uint8 slot)
 
void SetVisibleAura (uint8 slot, AuraApplication *aur)
 
void RemoveVisibleAura (uint8 slot)
 
uint32 GetInterruptMask () const
 
void AddInterruptMask (uint32 mask)
 
void UpdateInterruptMask ()
 
virtual float GetNativeObjectScale () const
 
virtual void RecalculateObjectScale ()
 
uint32 GetDisplayId () const
 
virtual void SetDisplayId (uint32 modelId, float displayScale=1.f)
 
uint32 GetNativeDisplayId () const
 
void RestoreDisplayId ()
 
void SetNativeDisplayId (uint32 displayId)
 
void setTransForm (uint32 spellid)
 
uint32 getTransForm () const
 
void _RegisterDynObject (DynamicObject *dynObj)
 
void _UnregisterDynObject (DynamicObject *dynObj)
 
DynamicObjectGetDynObject (uint32 spellId)
 
bool RemoveDynObject (uint32 spellId)
 
void RemoveAllDynObjects ()
 
GameObjectGetGameObject (uint32 spellId) const
 
void AddGameObject (GameObject *gameObj)
 
void RemoveGameObject (GameObject *gameObj, bool del)
 
void RemoveGameObject (uint32 spellid, bool del)
 
void RemoveAllGameObjects ()
 
void ModifyAuraState (AuraStateType flag, bool apply)
 
uint32 BuildAuraStateUpdateForTarget (Unit *target) const
 
bool HasAuraState (AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
 
void UnsummonAllTotems (bool onDeath=false)
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
UnitGetMeleeHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo=nullptr)
 
int32 SpellBaseDamageBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseDamageBonusTaken (SpellSchoolMask schoolMask, bool isDoT=false)
 
float SpellPctDamageModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellDamageBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellDamageBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
 
int32 SpellBaseHealingBonusDone (SpellSchoolMask schoolMask)
 
int32 SpellBaseHealingBonusTaken (SpellSchoolMask schoolMask)
 
float SpellPctHealingModsDone (Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
 
uint32 SpellHealingBonusDone (Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint8 effIndex, float TotalMod=0.0f, uint32 stack=1)
 
uint32 SpellHealingBonusTaken (Unit *caster, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack=1)
 
uint32 MeleeDamageBonusDone (Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
uint32 MeleeDamageBonusTaken (Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
 
bool isSpellBlocked (Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
 
bool isBlockCritical ()
 
float SpellDoneCritChance (Unit const *, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType, bool skipEffectCheck) const
 
float SpellTakenCritChance (Unit const *caster, SpellInfo const *spellProto, SpellSchoolMask schoolMask, float doneChance, WeaponAttackType attackType, bool skipEffectCheck) const
 
void SetLastManaUse (uint32 spellCastTime)
 
bool IsUnderLastManaUseEffect () const
 
void SetContestedPvP (Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
 
uint32 GetCastingTimeForBonus (SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
 
float CalculateDefaultCoefficient (SpellInfo const *spellInfo, DamageEffectType damagetype) const
 
void CastDelayedSpellWithPeriodicAmount (Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
 
void ApplySpellImmune (uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
 
void ApplySpellDispelImmunity (SpellInfo const *spellProto, DispelType type, bool apply)
 
virtual bool IsImmunedToSpell (SpellInfo const *spellInfo, Spell const *spell=nullptr)
 
bool IsImmunedToDamage (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamage (SpellInfo const *spellInfo) const
 
bool IsImmunedToDamage (Spell const *spell) const
 
bool IsImmunedToSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToSchool (SpellInfo const *spellInfo) const
 
bool IsImmunedToSchool (Spell const *spell) const
 
bool IsImmunedToDamageOrSchool (SpellSchoolMask meleeSchoolMask) const
 
bool IsImmunedToDamageOrSchool (SpellInfo const *spellInfo) const
 
virtual bool IsImmunedToSpellEffect (SpellInfo const *spellInfo, uint32 index) const
 
void UpdateSpeed (UnitMoveType mtype, bool forced)
 
float GetSpeed (UnitMoveType mtype) const
 
float GetSpeedRate (UnitMoveType mtype) const
 
void SetSpeed (UnitMoveType mtype, float rate, bool forced=false)
 
void SetSpeedRate (UnitMoveType mtype, float rate)
 
float ApplyEffectModifiers (SpellInfo const *spellProto, uint8 effect_index, float value) const
 
int32 CalculateSpellDamage (Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
 
int32 CalcSpellDuration (SpellInfo const *spellProto)
 
int32 ModSpellDuration (SpellInfo const *spellProto, Unit const *target, int32 duration, bool positive, uint32 effectMask)
 
void ModSpellCastTime (SpellInfo const *spellProto, int32 &castTime, Spell *spell=nullptr)
 
float CalculateLevelPenalty (SpellInfo const *spellProto) const
 
void addFollower (FollowerReference *pRef)
 
void removeFollower (FollowerReference *)
 
MotionMasterGetMotionMaster ()
 
const MotionMasterGetMotionMaster () const
 
virtual MovementGeneratorType GetDefaultMovementType () const
 -------—End of Pet responses methods-------— More...
 
bool IsStopped () const
 
void StopMoving ()
 
void StopMovingOnCurrentPos ()
 
virtual void PauseMovement (uint32 timer=0, uint8 slot=0)
 Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline. More...
 
void ResumeMovement (uint32 timer=0, uint8 slot=0)
 
void AddUnitMovementFlag (uint32 f)
 
void RemoveUnitMovementFlag (uint32 f)
 
bool HasUnitMovementFlag (uint32 f) const
 
uint32 GetUnitMovementFlags () const
 
void SetUnitMovementFlags (uint32 f)
 
void AddExtraUnitMovementFlag (uint16 f)
 
void RemoveExtraUnitMovementFlag (uint16 f)
 
uint16 HasExtraUnitMovementFlag (uint16 f) const
 
uint16 GetExtraUnitMovementFlags () const
 
void SetExtraUnitMovementFlags (uint16 f)
 
void SetControlled (bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
 
void DisableRotate (bool apply)
 
void DisableSpline ()
 
uint8 GetComboPoints (Unit const *who=nullptr) const
 --------—Combo point system----------------— More...
 
uint8 GetComboPoints (ObjectGuid const &guid) const
 
UnitGetComboTarget () const
 
ObjectGuid const GetComboTargetGUID () const
 
void AddComboPoints (Unit *target, int8 count)
 
void AddComboPoints (int8 count)
 
void ClearComboPoints ()
 
void SendComboPoints ()
 
void AddComboPointHolder (Unit *unit)
 
void RemoveComboPointHolder (Unit *unit)
 
void ClearComboPointHolders ()
 
void SendPetActionFeedback (uint8 msg)
 -------—Pet responses methods--------------— More...
 
void SendPetTalk (uint32 pettalk)
 
void SendPetAIReaction (ObjectGuid guid)
 
void propagateSpeedChange ()
 -------—End of Pet responses methods-------— More...
 
void ClearAllReactives ()
 
void StartReactiveTimer (ReactiveType reactive)
 
void UpdateReactives (uint32 p_time)
 
void UpdateAuraForGroup (uint8 slot)
 
bool CanProc ()
 
void SetCantProc (bool apply)
 
void AddPetAura (PetAura const *petSpell)
 
void RemovePetAura (PetAura const *petSpell)
 
void CastPetAura (PetAura const *aura)
 
bool IsPetAura (Aura const *aura)
 
uint32 GetModelForForm (ShapeshiftForm form, uint32 spellId) const
 
uint32 GetModelForTotem (PlayerTotemType totemType)
 
void SetRedirectThreat (ObjectGuid guid, uint32 pct)
 
void ResetRedirectThreat ()
 
void ModifyRedirectThreat (int32 amount)
 
uint32 GetRedirectThreatPercent ()
 
UnitGetRedirectThreatTarget () const
 
bool CreateVehicleKit (uint32 id, uint32 creatureEntry)
 
void RemoveVehicleKit ()
 
VehicleGetVehicleKit () const
 
VehicleGetVehicle () const
 
bool IsOnVehicle (Unit const *vehicle) const
 
UnitGetVehicleBase () const
 
CreatureGetVehicleCreatureBase () const
 
ObjectGuid GetTransGUID () const override
 
TransportBaseGetDirectTransport () const
 Returns the transport this unit is on directly (if on vehicle and transport, return vehicle) More...
 
bool HandleSpellClick (Unit *clicker, int8 seatId=-1)
 
void EnterVehicle (Unit *base, int8 seatId=-1)
 
void EnterVehicleUnattackable (Unit *base, int8 seatId=-1)
 
void ExitVehicle (Position const *exitPosition=nullptr)
 
void ChangeSeat (int8 seatId, bool next=true)
 
void _ExitVehicle (Position const *exitPosition=nullptr)
 
void _EnterVehicle (Vehicle *vehicle, int8 seatId, AuraApplication const *aurApp=nullptr)
 
void BuildMovementPacket (ByteBuffer *data) const
 
virtual bool CanSwim () const
 this method checks the current flag of a unit More...
 
bool IsLevitating () const
 
bool IsWalking () const
 
bool isMoving () const
 
bool isTurning () const
 
bool IsHovering () const
 
bool isSwimming () const
 
virtual bool CanFly () const =0
 
bool IsFlying () const
 
bool IsFalling () const
 
float GetHoverHeight () const
 
virtual bool CanEnterWater () const =0
 
void RewardRage (uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
 
virtual float GetFollowAngle () const
 
void OutDebugInfo () const
 
virtual bool isBeingLoaded () const
 
bool IsDuringRemoveFromWorld () const
 
PetToPet ()
 
TotemToTotem ()
 
TempSummonToTempSummon ()
 
const TempSummonToTempSummon () const
 
void AddPointedBy (SafeUnitPointer *sup)
 
void RemovePointedBy (SafeUnitPointer *sup)
 
void ExecuteDelayedUnitRelocationEvent ()
 
void ExecuteDelayedUnitAINotifyEvent ()
 
virtual bool HasSpellCooldown (uint32) const
 
virtual bool HasSpellItemCooldown (uint32, uint32) const
 
virtual void AddSpellCooldown (uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
 
bool CanApplyResilience () const
 
void PetSpellFail (SpellInfo const *spellInfo, Unit *target, uint32 result)
 
int32 CalculateAOEDamageReduction (int32 damage, uint32 schoolMask, Unit *caster) const
 
ObjectGuid GetTarget () const
 
virtual void SetTarget (ObjectGuid=ObjectGuid::Empty)=0
 
void SetInstantCast (bool set)
 
bool CanInstantCast () const
 
virtual void Talk (std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
 
virtual void Say (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void Yell (std::string_view text, Language language, WorldObject const *target=nullptr)
 
virtual void TextEmote (std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (std::string_view text, Language language, Player *target, bool isBossWhisper=false)
 
virtual void Talk (uint32 textId, ChatMsg msgType, float textRange, WorldObject const *target)
 
virtual void Say (uint32 textId, WorldObject const *target=nullptr)
 
virtual void Yell (uint32 textId, WorldObject const *target=nullptr)
 
virtual void TextEmote (uint32 textId, WorldObject const *target=nullptr, bool isBossEmote=false)
 
virtual void Whisper (uint32 textId, Player *target, bool isBossWhisper=false)
 
float GetCollisionHeight () const override
 Return collision height sent to client. More...
 
float GetCollisionWidth () const override
 this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC More...
 
float GetCollisionRadius () const override
 this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC More...
 
void ProcessPositionDataChanged (PositionFullTerrainStatus const &data) override
 
virtual void ProcessTerrainStatusUpdate ()
 
bool CanRestoreMana (SpellInfo const *spellInfo) const
 
std::string GetDebugInfo () const override
 
uint32 GetOldFactionId () const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim. More...
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual std::string GetDebugInfo () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 

Static Public Member Functions

static float GetEffectiveResistChance (Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
 
static void DealDamageMods (Unit const *victim, uint32 &damage, uint32 *absorb)
 
static uint32 DealDamage (Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
 
static void Kill (Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
 
static int32 DealHeal (Unit *healer, Unit *victim, uint32 addhealth)
 
static void ProcDamageAndSpell (Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
 
static void ApplyResilience (Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
 
static uint32 SpellCriticalDamageBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static uint32 SpellCriticalHealingBonus (Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
 
static bool IsDamageReducedByArmor (SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
 
static uint32 CalcArmorReducedDamage (Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
 
static void CalcAbsorbResist (DamageInfo &dmgInfo, bool Splited=false)
 
static void CalcHealAbsorb (HealInfo &healInfo)
 
static void HandleSafeUnitPointersOnDelete (Unit *thisUnit)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

uint32 m_extraAttacks
 
bool m_canDualWield
 
ControlSet m_Controlled
 
SafeUnitPointer m_movedByPlayer
 
ObjectGuid m_SummonSlot [MAX_SUMMON_SLOT]
 
ObjectGuid m_ObjectSlot [MAX_GAMEOBJECT_SLOT]
 
float m_modMeleeHitChance
 
float m_modRangedHitChance
 
float m_modSpellHitChance
 
int32 m_baseSpellCritChance
 
float m_threatModifier [MAX_SPELL_SCHOOL]
 
float m_modAttackSpeedPct [3]
 
EventProcessor m_Events
 
SpellImmuneList m_spellImmune [MAX_SPELL_IMMUNITY]
 
uint32 m_lastSanctuaryTime
 
PetAuraSet m_petAuras
 
bool IsAIEnabled
 
bool NeedChangeAI
 
bool m_ControlledByPlayer
 
bool m_CreatedByPlayer
 
std::set< SafeUnitPointer * > SafeUnitPointerSet
 
Position m_last_notify_position
 
uint32 m_last_notify_mstime
 
uint16 m_delayed_unit_relocation_timer
 
uint16 m_delayed_unit_ai_notify_timer
 
bool bRequestForcedVisibilityUpdate
 
Movement::MoveSplinemovespline
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Protected Types

typedef std::list< DynamicObject * > DynObjectList
 
typedef GuidList GameObjectList
 
typedef std::map< ObjectGuid, float > CharmThreatMap
 

Protected Member Functions

 Unit (bool isWorldObject)
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
void _UpdateSpells (uint32 time)
 
void _DeleteRemovedAuras ()
 
void _UpdateAutoRepeatSpell ()
 
bool IsAlwaysVisibleFor (WorldObject const *seer) const override
 
bool IsAlwaysDetectableFor (WorldObject const *seer) const override
 
void SetFeared (bool apply, Unit *fearedBy=nullptr, bool isFear=false)
 
void SetConfused (bool apply)
 
void SetStunned (bool apply)
 
void SetRooted (bool apply, bool isStun=false)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target)
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

UnitAIi_AI
 
UnitAIi_disabledAI
 
uint8 m_realRace
 
uint8 m_race
 
bool m_AutoRepeatFirstCast
 
int32 m_attackTimer [MAX_ATTACK]
 
float m_createStats [MAX_STATS]
 
AttackerSet m_attackers
 
Unitm_attacking
 
DeathState m_deathState
 
int32 m_procDeep
 
DynObjectList m_dynObj
 
GameObjectList m_gameObj
 
uint32 m_transform
 
Spellm_currentSpells [CURRENT_MAX_SPELL]
 
AuraMap m_ownedAuras
 
AuraApplicationMap m_appliedAuras
 
AuraList m_removedAuras
 
AuraMap::iterator m_auraUpdateIterator
 
uint32 m_removedAurasCount
 
AuraEffectList m_modAuras [TOTAL_AURAS]
 
AuraList m_scAuras
 
AuraApplicationList m_interruptableAuras
 
AuraStateAurasMap m_auraStateAuras
 
uint32 m_interruptMask
 
float m_auraModifiersGroup [UNIT_MOD_END][MODIFIER_TYPE_END]
 
float m_weaponDamage [MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
 
bool m_canModifyStats
 
VisibleAuraMap m_visibleAuras
 
float m_speed_rate [MAX_MOVE_TYPE]
 
CharmInfom_charmInfo
 
SharedVisionList m_sharedVision
 
MotionMasteri_motionMaster
 
uint32 m_reactiveTimer [MAX_REACTIVE]
 
int32 m_regenTimer
 
ThreatMgr m_ThreatMgr
 
CharmThreatMap _charmThreatInfo
 
Vehiclem_vehicle
 
Vehiclem_vehicleKit
 
uint32 m_unitTypeMask
 
LiquidTypeEntry const * _lastLiquid
 
bool m_applyResilience
 
bool _instantCast
 
uint32 m_rootTimes
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Types

typedef std::unordered_map< uint64, BuildValuesCachedBufferValuesUpdateCache
 

Private Member Functions

bool IsTriggeredAtSpellProcEvent (Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
 
bool HandleDummyAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, ProcEventInfo const &eventInfo)
 
bool HandleAuraProc (Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
 
bool HandleProcTriggerSpell (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
 
bool HandleOverrideClassScriptAuraProc (Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
 
bool HandleAuraRaidProcFromChargeWithValue (AuraEffect *triggeredByAura)
 
bool HandleAuraRaidProcFromCharge (AuraEffect *triggeredByAura)
 
void UpdateSplineMovement (uint32 t_diff)
 
void UpdateSplinePosition ()
 
float GetCombatRatingReduction (CombatRating cr) const
 
uint32 GetCombatRatingDamageReduction (CombatRating cr, float rate, float cap, uint32 damage) const
 
void PatchValuesUpdate (ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
 
void InvalidateValuesUpdateCache ()
 
float processDummyAuras (float TakenTotalMod) const
 

Private Attributes

uint32 m_state
 
uint32 m_CombatTimer
 
uint32 m_lastManaUse
 
Diminishing m_Diminishing
 
HostileRefMgr m_HostileRefMgr
 
FollowerRefMgr m_FollowingRefMgr
 
Unitm_comboTarget
 
int8 m_comboPoints
 
std::unordered_set< Unit * > m_ComboPointHolders
 
RedirectThreatInfo _redirectThreatInfo
 
bool m_cleanupDone
 
bool m_duringRemoveFromWorld
 
uint32 _oldFactionId
 faction before charm More...
 
bool _isWalkingBeforeCharm
 Are we walking before we were charmed? More...
 
uint32 _lastExtraAttackSpell
 
std::unordered_map< ObjectGuid, uint32extraAttacksTargets
 
ObjectGuid _lastDamagedTargetGuid
 
ValuesUpdateCache _valuesUpdateCache
 

Detailed Description

Member Typedef Documentation

◆ AttackerSet

typedef std::unordered_set<Unit*> Unit::AttackerSet

◆ AuraApplicationList

◆ AuraApplicationMap

◆ AuraApplicationMapBounds

typedef std::pair<AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator> Unit::AuraApplicationMapBounds

◆ AuraApplicationMapBoundsNonConst

typedef std::pair<AuraApplicationMap::iterator, AuraApplicationMap::iterator> Unit::AuraApplicationMapBoundsNonConst

◆ AuraEffectList

typedef std::list<AuraEffect*> Unit::AuraEffectList

◆ AuraList

typedef std::list<Aura*> Unit::AuraList

◆ AuraMap

typedef std::multimap<uint32, Aura*> Unit::AuraMap

◆ AuraMapBounds

typedef std::pair<AuraMap::const_iterator, AuraMap::const_iterator> Unit::AuraMapBounds

◆ AuraMapBoundsNonConst

typedef std::pair<AuraMap::iterator, AuraMap::iterator> Unit::AuraMapBoundsNonConst

◆ AuraStateAurasMap

◆ AuraStateAurasMapBounds

typedef std::pair<AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator> Unit::AuraStateAurasMapBounds

◆ CharmThreatMap

typedef std::map<ObjectGuid, float> Unit::CharmThreatMap
protected

◆ ComboPointHolderSet

◆ ControlSet

typedef std::set<Unit*> Unit::ControlSet

◆ Diminishing

◆ DynObjectList

typedef std::list<DynamicObject*> Unit::DynObjectList
protected

◆ GameObjectList

typedef GuidList Unit::GameObjectList
protected

◆ PetAuraSet

typedef std::set<PetAura const*> Unit::PetAuraSet

◆ ValuesUpdateCache

typedef std::unordered_map<uint64 , BuildValuesCachedBuffer> Unit::ValuesUpdateCache
private

◆ VisibleAuraMap

Constructor & Destructor Documentation

◆ ~Unit()

Unit::~Unit ( )
override
340{
341 // set current spells as deletable
342 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
343 if (m_currentSpells[i])
344 {
346 m_currentSpells[i] = nullptr;
347 }
348
350
351 delete i_motionMaster;
352 delete m_charmInfo;
353 delete movespline;
354
357 ASSERT(m_attackers.empty());
358
359 // pussywizard: clear m_sharedVision along with back references
360 if (!m_sharedVision.empty())
361 {
362 do
363 {
364 Player* p = *(m_sharedVision.begin());
365 p->m_isInSharedVisionOf.erase(this);
366 m_sharedVision.remove(p);
367 } while (!m_sharedVision.empty());
368 }
369
370 ASSERT(m_Controlled.empty());
371 ASSERT(m_appliedAuras.empty());
372 ASSERT(m_ownedAuras.empty());
373 ASSERT(m_removedAuras.empty());
374 ASSERT(m_gameObj.empty());
375 ASSERT(m_dynObj.empty());
376
377 if (m_movedByPlayer && m_movedByPlayer != this)
378 LOG_INFO("misc", "Unit::~Unit (A1)");
379
381}
#define CURRENT_MAX_SPELL
Definition: Unit.h:544
#define ASSERT
Definition: Errors.h:68
#define LOG_INFO(filterType__,...)
Definition: Log.h:164
std::uint8_t uint8
Definition: Define.h:109
Definition: Player.h:1063
std::set< Unit * > m_isInSharedVisionOf
Definition: Player.h:2311
bool m_duringRemoveFromWorld
Definition: Unit.h:1935
Spell * m_currentSpells[CURRENT_MAX_SPELL]
Definition: Unit.h:1844
AuraList m_removedAuras
Definition: Unit.h:1848
ControlSet m_Controlled
Definition: Unit.h:1210
Movement::MoveSpline * movespline
Definition: Unit.h:1783
CharmInfo * m_charmInfo
Definition: Unit.h:1865
MotionMaster * i_motionMaster
Definition: Unit.h:1868
void _DeleteRemovedAuras()
Definition: Unit.cpp:3802
DynObjectList m_dynObj
Definition: Unit.h:1838
SafeUnitPointer m_movedByPlayer
Definition: Unit.h:1231
AttackerSet m_attackers
Definition: Unit.h:1830
Unit * m_attacking
Definition: Unit.h:1831
GameObjectList m_gameObj
Definition: Unit.h:1841
AuraMap m_ownedAuras
Definition: Unit.h:1846
AuraApplicationMap m_appliedAuras
Definition: Unit.h:1847
static void HandleSafeUnitPointersOnDelete(Unit *thisUnit)
Definition: Unit.cpp:4294
SharedVisionList m_sharedVision
Definition: Unit.h:1866
void SetReferencedFromCurrent(bool yes)
Definition: Spell.h:559

References _DeleteRemovedAuras(), ASSERT, CURRENT_MAX_SPELL, HandleSafeUnitPointersOnDelete(), i_motionMaster, LOG_INFO, m_appliedAuras, m_attackers, m_attacking, m_charmInfo, m_Controlled, m_currentSpells, m_duringRemoveFromWorld, m_dynObj, m_gameObj, Player::m_isInSharedVisionOf, m_movedByPlayer, m_ownedAuras, m_removedAuras, m_sharedVision, movespline, and Spell::SetReferencedFromCurrent().

◆ Unit()

Unit::Unit ( bool  isWorldObject)
explicitprotected
204 : WorldObject(isWorldObject),
205 m_movedByPlayer(nullptr),
207 IsAIEnabled(false),
208 NeedChangeAI(false),
210 m_CreatedByPlayer(false),
212 i_AI(nullptr),
213 i_disabledAI(nullptr),
214 m_realRace(0),
215 m_race(0),
217 m_procDeep(0),
219 i_motionMaster(new MotionMaster(this)),
220 m_regenTimer(0),
221 m_ThreatMgr(this),
222 m_vehicle(nullptr),
223 m_vehicleKit(nullptr),
225 m_HostileRefMgr(this),
226 m_comboTarget(nullptr),
228{
229#ifdef _MSC_VER
230#pragma warning(default:4355)
231#endif
234
236
243
244 m_canDualWield = false;
245
246 m_rootTimes = 0;
247
248 m_state = 0;
249 m_deathState = DeathState::Alive;
250
251 for (uint8 i = 0; i < CURRENT_MAX_SPELL; ++i)
252 m_currentSpells[i] = nullptr;
253
254 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
255 m_SummonSlot[i].Clear();
256
257 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
258 m_ObjectSlot[i].Clear();
259
261
262 m_interruptMask = 0;
263 m_transform = 0;
264 m_canModifyStats = false;
265
266 for (uint8 i = 0; i < MAX_SPELL_IMMUNITY; ++i)
267 m_spellImmune[i].clear();
268
269 for (uint8 i = 0; i < UNIT_MOD_END; ++i)
270 {
275 }
276 // implement 50% base damage from offhand
278
279 for (uint8 i = 0; i < MAX_ATTACK; ++i)
280 {
283
284 m_weaponDamage[i][MINDAMAGE][1] = 0.f;
285 m_weaponDamage[i][MAXDAMAGE][1] = 0.f;
286 }
287
288 for (uint8 i = 0; i < MAX_STATS; ++i)
289 m_createStats[i] = 0.0f;
290
291 m_attacking = nullptr;
292 m_modMeleeHitChance = 0.0f;
294 m_modSpellHitChance = 0.0f;
296
297 m_CombatTimer = 0;
298 m_lastManaUse = 0;
299
300 for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
301 m_threatModifier[i] = 1.0f;
302
303 for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i)
304 m_speed_rate[i] = 1.0f;
305
306 m_charmInfo = nullptr;
307
309
310 // remove aurastates allowing special moves
311 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
312 m_reactiveTimer[i] = 0;
313
314 m_cleanupDone = false;
316
318
319 m_last_notify_position.Relocate(-5000.0f, -5000.0f, -5000.0f, 0.0f);
324
325 m_applyResilience = false;
326 _instantCast = false;
327
328 _lastLiquid = nullptr;
329
330 _oldFactionId = 0;
331
332 _isWalkingBeforeCharm = false;
333
335}
@ TYPEID_UNIT
Definition: ObjectGuid.h:35
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:49
@ UPDATEFLAG_LIVING
Definition: UpdateData.h:44
@ UPDATEFLAG_STATIONARY_POSITION
Definition: UpdateData.h:45
@ MINDAMAGE
Definition: Unit.h:135
@ MAXDAMAGE
Definition: Unit.h:136
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:166
@ UNIT_MOD_END
Definition: Unit.h:168
#define MAX_SUMMON_SLOT
Definition: Unit.h:601
@ OFF_ATTACK
Definition: Unit.h:210
@ MAX_ATTACK
Definition: Unit.h:212
@ BASE_ATTACK
Definition: Unit.h:209
@ RANGED_ATTACK
Definition: Unit.h:211
@ BASE_VALUE
Definition: Unit.h:126
@ TOTAL_VALUE
Definition: Unit.h:128
@ TOTAL_PCT
Definition: Unit.h:129
@ BASE_PCT
Definition: Unit.h:127
#define BASE_MAXDAMAGE
Definition: Unit.h:40
@ MAX_REACTIVE
Definition: Unit.h:593
#define MAX_GAMEOBJECT_SLOT
Definition: Unit.h:603
#define BASE_MINDAMAGE
Definition: Unit.h:39
@ UNIT_MASK_NONE
Definition: UnitDefines.h:134
#define MAX_MOVE_TYPE
Definition: UnitDefines.h:339
@ SERVERSIDE_VISIBILITY_GHOST
Definition: SharedDefines.h:1274
#define MAX_STATS
Definition: SharedDefines.h:265
constexpr auto MAX_SPELL_SCHOOL
Definition: SharedDefines.h:292
@ GHOST_VISIBILITY_ALIVE
Definition: SharedDefines.h:1281
#define MAX_SPELL_IMMUNITY
Definition: SharedDefines.h:1404
Definition: ThreatMgr.h:294
uint16 m_objectType
Definition: Object.h:238
uint16 m_updateFlag
Definition: Object.h:241
TypeID m_objectTypeId
Definition: Object.h:240
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:370
Definition: Object.h:403
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:521
void Relocate(float x, float y)
Definition: Position.h:73
uint32 m_reactiveTimer[MAX_REACTIVE]
Definition: Unit.h:1870
uint32 m_lastSanctuaryTime
Definition: Unit.h:1480
LiquidTypeEntry const * _lastLiquid
Definition: Unit.h:1881
uint32 m_transform
Definition: Unit.h:1842
uint32 m_CombatTimer
Definition: Unit.h:1918
bool m_canModifyStats
Definition: Unit.h:1860
bool NeedChangeAI
Definition: Unit.h:1693
uint32 m_state
Definition: Unit.h:1917
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END]
Definition: Unit.h:1858
int32 m_attackTimer[MAX_ATTACK]
Definition: Unit.h:1826
float m_modAttackSpeedPct[3]
Definition: Unit.h:1434
uint8 m_realRace
Definition: Unit.h:1821
Vehicle * m_vehicle
Definition: Unit.h:1877
uint32 m_rootTimes
Definition: Unit.h:1914
uint8 m_race
Definition: Unit.h:1822
UnitAI * i_AI
Definition: Unit.h:1814
uint32 _lastExtraAttackSpell
Definition: Unit.h:1942
bool _instantCast
Definition: Unit.h:1887
ObjectGuid m_ObjectSlot[MAX_GAMEOBJECT_SLOT]
Definition: Unit.h:1412
RedirectThreatInfo _redirectThreatInfo
Definition: Unit.h:1932
float m_createStats[MAX_STATS]
Definition: Unit.h:1828
float m_modRangedHitChance
Definition: Unit.h:1429
DeathState m_deathState
Definition: Unit.h:1833
uint32 m_unitTypeMask
Definition: Unit.h:1880
uint32 m_removedAurasCount
Definition: Unit.h:1850
ThreatMgr m_ThreatMgr
Definition: Unit.h:1873
Unit * m_comboTarget
Definition: Unit.h:1928
AuraMap::iterator m_auraUpdateIterator
Definition: Unit.h:1849
bool m_AutoRepeatFirstCast
Definition: Unit.h:1824
uint16 m_delayed_unit_ai_notify_timer
Definition: Unit.h:1755
int32 m_regenTimer
Definition: Unit.h:1871
bool bRequestForcedVisibilityUpdate
Definition: Unit.h:1756
bool m_ControlledByPlayer
Definition: Unit.h:1705
uint32 m_last_notify_mstime
Definition: Unit.h:1753
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]
Definition: Unit.h:1479
int8 m_comboPoints
Definition: Unit.h:1929
uint32 _oldFactionId
faction before charm
Definition: Unit.h:1937
int32 m_baseSpellCritChance
Definition: Unit.h:1431
float m_modMeleeHitChance
Definition: Unit.h:1428
float m_weaponDamage[MAX_ATTACK][MAX_WEAPON_DAMAGE_RANGE][MAX_ITEM_PROTO_DAMAGES]
Definition: Unit.h:1859
Position m_last_notify_position
Definition: Unit.h:1752
Vehicle * m_vehicleKit
Definition: Unit.h:1878
bool IsAIEnabled
Definition: Unit.h:1693
HostileRefMgr m_HostileRefMgr
Definition: Unit.h:1924
bool m_applyResilience
Definition: Unit.h:1884
bool m_canDualWield
Definition: Unit.h:696
uint32 m_interruptMask
Definition: Unit.h:1856
int32 m_procDeep
Definition: Unit.h:1835
float m_speed_rate[MAX_MOVE_TYPE]
Definition: Unit.h:1863
float m_modSpellHitChance
Definition: Unit.h:1430
UnitAI * i_disabledAI
Definition: Unit.h:1814
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition: Unit.h:1411
bool m_cleanupDone
Definition: Unit.h:1934
bool _isWalkingBeforeCharm
Are we walking before we were charmed?
Definition: Unit.h:1938
bool m_CreatedByPlayer
Definition: Unit.h:1706
uint16 m_delayed_unit_relocation_timer
Definition: Unit.h:1754
float m_threatModifier[MAX_SPELL_SCHOOL]
Definition: Unit.h:1433
uint32 m_lastManaUse
Definition: Unit.h:1919
Definition: MotionMaster.h:110
Definition: MoveSpline.h:40

References _instantCast, _isWalkingBeforeCharm, _lastExtraAttackSpell, _lastLiquid, _oldFactionId, _redirectThreatInfo, BASE_ATTACK, BASE_MAXDAMAGE, BASE_MINDAMAGE, BASE_PCT, BASE_VALUE, bRequestForcedVisibilityUpdate, CURRENT_MAX_SPELL, GHOST_VISIBILITY_ALIVE, m_applyResilience, m_attacking, m_attackTimer, m_auraModifiersGroup, m_auraUpdateIterator, m_baseSpellCritChance, m_canDualWield, m_canModifyStats, m_charmInfo, m_cleanupDone, m_CombatTimer, m_createStats, m_currentSpells, m_deathState, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_duringRemoveFromWorld, m_interruptMask, m_last_notify_mstime, m_last_notify_position, m_lastManaUse, m_modAttackSpeedPct, m_modMeleeHitChance, m_modRangedHitChance, m_modSpellHitChance, m_ObjectSlot, Object::m_objectType, Object::m_objectTypeId, m_ownedAuras, m_reactiveTimer, m_rootTimes, WorldObject::m_serverSideVisibility, m_speed_rate, m_spellImmune, m_state, m_SummonSlot, m_threatModifier, m_transform, Object::m_updateFlag, m_weaponDamage, MAX_ATTACK, MAX_GAMEOBJECT_SLOT, MAX_MOVE_TYPE, MAX_REACTIVE, MAX_SPELL_IMMUNITY, MAX_SPELL_SCHOOL, MAX_STATS, MAX_SUMMON_SLOT, MAXDAMAGE, MINDAMAGE, OFF_ATTACK, RANGED_ATTACK, Position::Relocate(), SERVERSIDE_VISIBILITY_GHOST, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), TOTAL_PCT, TOTAL_VALUE, TYPEID_UNIT, TYPEMASK_UNIT, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_END, UPDATEFLAG_LIVING, and UPDATEFLAG_STATIONARY_POSITION.

Member Function Documentation

◆ _addAttacker()

void Unit::_addAttacker ( Unit pAttacker)
inline
699 {
700 m_attackers.insert(pAttacker);
701 }

References m_attackers.

Referenced by Attack().

◆ _AddAura()

void Unit::_AddAura ( UnitAura aura,
Unit caster 
)
4380{
4382 m_ownedAuras.insert(AuraMap::value_type(aura->GetId(), aura));
4383
4385
4386 if (aura->IsRemoved())
4387 return;
4388
4390 if (aura->IsSingleTarget())
4391 {
4392 ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
4393 /* @HACK: Player is not in world during loading auras.
4394 * Single target auras are not saved or loaded from database
4395 * but may be created as a result of aura links (player mounts with passengers)
4396 */
4397
4398 // register single target aura
4399 caster->GetSingleCastAuras().push_back(aura);
4400 // remove other single target auras
4401 Unit::AuraList& scAuras = caster->GetSingleCastAuras();
4402 for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
4403 {
4404 if ((*itr) != aura &&
4405 (*itr)->IsSingleTargetWith(aura))
4406 {
4407 (*itr)->Remove();
4408 itr = scAuras.begin();
4409 }
4410 else
4411 ++itr;
4412 }
4413 }
4414}
@ SPELL_AURA_CONTROL_VEHICLE
Definition: SpellAuraDefines.h:299
bool IsInWorld() const
Definition: Object.h:104
ObjectGuid GetGUID() const
Definition: Object.h:110
void _RemoveNoStackAurasDueToAura(Aura *aura)
Definition: Unit.cpp:4629
std::list< Aura * > AuraList
Definition: Unit.h:647
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:1739
AuraList & GetSingleCastAuras()
Definition: Unit.h:1311
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:105
bool IsRemoved() const
Definition: SpellAuras.h:161
uint32 GetId() const
Definition: SpellAuras.cpp:466
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1222
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:100
void SetIsSingleTarget(bool val)
Definition: SpellAuras.h:166
bool IsSingleTarget() const
Definition: SpellAuras.h:164
bool IsSingleTarget() const
Definition: SpellInfo.cpp:1373

References _RemoveNoStackAurasDueToAura(), ASSERT, Aura::GetCasterGUID(), Object::GetGUID(), Aura::GetId(), GetSingleCastAuras(), Aura::GetSpellInfo(), Aura::HasEffectType(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Aura::IsRemoved(), Aura::IsSingleTarget(), SpellInfo::IsSingleTarget(), Aura::IsSingleTargetWith(), m_cleanupDone, m_ownedAuras, Aura::SetIsSingleTarget(), and SPELL_AURA_CONTROL_VEHICLE.

Referenced by UnitAura::UnitAura().

◆ _ApplyAllAuraStatMods()

void Unit::_ApplyAllAuraStatMods ( )
5440{
5441 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5442 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, true);
5443}
@ AURA_EFFECT_HANDLE_STAT
Definition: SpellAuraDefines.h:46

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_ApplyAllStatBonuses().

◆ _ApplyAura()

void Unit::_ApplyAura ( AuraApplication aurApp,
uint8  effMask 
)
4471{
4472 Aura* aura = aurApp->GetBase();
4473
4475
4476 if (aurApp->GetRemoveMode())
4477 return;
4478
4479 Unit* caster = aura->GetCaster();
4480
4481 // Update target aura state flag
4482 SpellInfo const* spellInfo = aura->GetSpellInfo();
4483 if (AuraStateType aState = spellInfo->GetAuraState())
4484 {
4485 uint32 aStateMask = (1 << (aState - 1));
4486 // force update so the new caster registers it
4487 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) && HasFlag(UNIT_FIELD_AURASTATE, aStateMask))
4489 else
4490 ModifyAuraState(aState, true);
4491 }
4492
4493 if (aurApp->GetRemoveMode())
4494 return;
4495
4496 // Sitdown on apply aura req seated
4499
4500 if (aurApp->GetRemoveMode())
4501 return;
4502
4503 aura->HandleAuraSpecificMods(aurApp, caster, true, false);
4504
4505 // apply effects of the aura
4506 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4507 {
4508 if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
4509 aurApp->_HandleEffect(i, true);
4510 }
4511
4512 sScriptMgr->OnAuraApply(this, aura);
4513}
@ AURA_INTERRUPT_FLAG_NOT_SEATED
Definition: SpellDefines.h:62
@ UNIT_FIELD_AURASTATE
Definition: UpdateFields.h:119
@ UNIT_STAND_STATE_SIT
Definition: UnitDefines.h:33
#define sScriptMgr
Definition: ScriptMgr.h:707
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1637
#define PER_CASTER_AURA_STATE_MASK
Definition: SharedDefines.h:1318
AuraStateType
Definition: SharedDefines.h:1288
std::uint32_t uint32
Definition: Define.h:107
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:889
void ForceValuesUpdateAtIndex(uint32)
Definition: Object.cpp:2067
Definition: Unit.h:630
void ModifyAuraState(AuraStateType flag, bool apply)
Definition: Unit.cpp:10437
void SetStandState(uint8 state)
Definition: Unit.cpp:16654
bool IsSitState() const
Definition: Unit.cpp:16639
void _HandleEffect(uint8 effIndex, bool apply)
Definition: SpellAuras.cpp:161
Aura * GetBase() const
Definition: SpellAuras.h:62
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:73
Definition: SpellAuras.h:87
Unit * GetCaster() const
Definition: SpellAuras.cpp:471
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition: SpellAuras.cpp:1265
Definition: SpellInfo.h:316
AuraStateType GetAuraState() const
Definition: SpellInfo.cpp:2059
uint32 AuraInterruptFlags
Definition: SpellInfo.h:353

References AuraApplication::_HandleEffect(), _RemoveNoStackAurasDueToAura(), AURA_INTERRUPT_FLAG_NOT_SEATED, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), Aura::HandleAuraSpecificMods(), Object::HasFlag(), IsSitState(), MAX_SPELL_EFFECTS, ModifyAuraState(), PER_CASTER_AURA_STATE_MASK, SetStandState(), sScriptMgr, UNIT_FIELD_AURASTATE, and UNIT_STAND_STATE_SIT.

Referenced by _ApplyAuraEffect().

◆ _ApplyAuraEffect()

void Unit::_ApplyAuraEffect ( Aura aura,
uint8  effIndex 
)
4457{
4458 ASSERT(aura);
4459 ASSERT(aura->HasEffect(effIndex));
4461 ASSERT(aurApp);
4462 if (!aurApp->GetEffectMask())
4463 _ApplyAura(aurApp, 1 << effIndex);
4464 else
4465 aurApp->_HandleEffect(effIndex, true);
4466}
void _ApplyAura(AuraApplication *aurApp, uint8 effMask)
Definition: Unit.cpp:4470
Definition: SpellAuras.h:37
uint8 GetEffectMask() const
Definition: SpellAuras.h:66
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:173
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:183

References _ApplyAura(), AuraApplication::_HandleEffect(), ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetEffectMask(), Object::GetGUID(), and Aura::HasEffect().

◆ _CreateAuraApplication()

AuraApplication * Unit::_CreateAuraApplication ( Aura aura,
uint8  effMask 
)
4419{
4420 // can't apply aura on unit which is going to be deleted - to not create a memory leak
4422 // aura musn't be removed
4423 ASSERT(!aura->IsRemoved());
4424
4425 // aura mustn't be already applied on target
4426 ASSERT (!aura->IsAppliedOnTarget(GetGUID()) && "Unit::_CreateAuraApplication: aura musn't be applied on target");
4427
4428 SpellInfo const* aurSpellInfo = aura->GetSpellInfo();
4429 uint32 aurId = aurSpellInfo->Id;
4430
4431 // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
4432 // Xinef: Added IsAllowingDeadTarget check
4433 if (!IsAlive() && !aurSpellInfo->IsDeathPersistent() && !aurSpellInfo->IsAllowingDeadTarget() && (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetSession()->PlayerLoading()))
4434 return nullptr;
4435
4436 Unit* caster = aura->GetCaster();
4437
4438 AuraApplication* aurApp = new AuraApplication(this, caster, aura, effMask);
4439 m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp));
4440
4441 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4442 // xinef: even if it gets removed, it will be reapplied in a second
4443 if (aurSpellInfo->AuraInterruptFlags && this == aura->GetOwner())
4444 {
4445 m_interruptableAuras.push_back(aurApp);
4446 AddInterruptMask(aurSpellInfo->AuraInterruptFlags);
4447 }
4448
4449 if (AuraStateType aState = aura->GetSpellInfo()->GetAuraState())
4450 m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp));
4451
4452 aura->_ApplyForTarget(this, caster, aurApp);
4453 return aurApp;
4454}
@ TYPEID_PLAYER
Definition: ObjectGuid.h:36
Player * ToPlayer()
Definition: Object.h:198
TypeID GetTypeId() const
Definition: Object.h:124
void AddInterruptMask(uint32 mask)
Definition: Unit.h:1506
bool IsAlive() const
Definition: Unit.h:1151
AuraApplicationList m_interruptableAuras
Definition: Unit.h:1854
AuraStateAurasMap m_auraStateAuras
Definition: Unit.h:1855
WorldObject * GetOwner() const
Definition: SpellAuras.h:107
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition: SpellAuras.h:185
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:492
bool IsDeathPersistent() const
Definition: SpellInfo.cpp:1216
uint32 Id
Definition: SpellInfo.h:320
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1226

References Aura::_ApplyForTarget(), AddInterruptMask(), ASSERT, SpellInfo::AuraInterruptFlags, SpellInfo::GetAuraState(), Aura::GetCaster(), Object::GetGUID(), Aura::GetOwner(), Aura::GetSpellInfo(), Object::GetTypeId(), SpellInfo::Id, IsAlive(), SpellInfo::IsAllowingDeadTarget(), Aura::IsAppliedOnTarget(), SpellInfo::IsDeathPersistent(), Aura::IsRemoved(), m_appliedAuras, m_auraStateAuras, m_cleanupDone, m_interruptableAuras, Object::ToPlayer(), and TYPEID_PLAYER.

◆ _DeleteRemovedAuras()

void Unit::_DeleteRemovedAuras ( )
protected
3803{
3804 while (!m_removedAuras.empty())
3805 {
3806 delete m_removedAuras.front();
3807 m_removedAuras.pop_front();
3808 }
3809}

References m_removedAuras.

Referenced by _UpdateSpells(), and ~Unit().

◆ _EnterVehicle()

void Unit::_EnterVehicle ( Vehicle vehicle,
int8  seatId,
AuraApplication const *  aurApp = nullptr 
)
19562{
19563 // Must be called only from aura handler
19564 if (!IsAlive() || GetVehicleKit() == vehicle || vehicle->GetBase()->IsOnVehicle(this))
19565 return;
19566
19567 if (m_vehicle)
19568 {
19569 if (m_vehicle == vehicle)
19570 {
19571 if (seatId >= 0 && seatId != GetTransSeat())
19572 {
19573 LOG_DEBUG("vehicles", "EnterVehicle: {} leave vehicle {} seat {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId);
19574 ChangeSeat(seatId);
19575 }
19576
19577 return;
19578 }
19579 else
19580 {
19581 LOG_DEBUG("vehicles", "EnterVehicle: {} exit {} and enter {}.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry());
19582 ExitVehicle();
19583 }
19584 }
19585
19586 if (!aurApp || aurApp->GetRemoveMode())
19587 return;
19588
19589 if (Player* player = ToPlayer())
19590 {
19591 if (vehicle->GetBase()->IsPlayer() && player->IsInCombat())
19592 return;
19593
19594 sScriptMgr->AnticheatSetUnderACKmount(player);
19595
19597 player->StopCastingCharm();
19598 player->StopCastingBindSight();
19599 Dismount();
19601
19602 // drop flag at invisible in bg
19603 if (Battleground* bg = player->GetBattleground())
19604 bg->EventPlayerDroppedFlag(player);
19605
19607 player->GetSession()->SendPacket(&data);
19608 }
19609
19610 ASSERT(!m_vehicle);
19611 m_vehicle = vehicle;
19612
19613 if (!m_vehicle->AddPassenger(this, seatId))
19614 {
19615 m_vehicle = nullptr;
19616 return;
19617 }
19618
19619 // Xinef: remove movement auras when entering vehicle (food buffs etc)
19621}
@ AURA_INTERRUPT_FLAG_MOVE
Definition: SpellDefines.h:47
@ AURA_INTERRUPT_FLAG_TURNING
Definition: SpellDefines.h:48
@ SPELL_AURA_MOUNTED
Definition: SpellAuraDefines.h:141
#define LOG_DEBUG(filterType__,...)
Definition: Log.h:168
@ SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA
Definition: Opcodes.h:1211
Definition: Battleground.h:298
bool IsPlayer() const
Definition: Object.h:197
uint32 GetEntry() const
Definition: Object.h:112
int8 GetTransSeat() const
Definition: Object.h:603
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4094
void Dismount()
Definition: Unit.cpp:13459
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.h:1698
void RemoveAurasByType(AuraType auraType, ObjectGuid casterGUID=ObjectGuid::Empty, Aura *except=nullptr, bool negative=true, bool positive=true)
Definition: Unit.cpp:5061
void ChangeSeat(int8 seatId, bool next=true)
Definition: Unit.cpp:19623
Vehicle * GetVehicleKit() const
Definition: Unit.h:1696
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except=0, bool isAutoshot=false)
Definition: Unit.cpp:5132
void ExitVehicle(Position const *exitPosition=nullptr)
Definition: Unit.cpp:19642
Unit * GetBase() const
May be called from scripts.
Definition: Vehicle.h:37
bool AddPassenger(Unit *passenger, int8 seatId=-1)
Definition: Vehicle.cpp:305
Definition: WorldPacket.h:27

References Vehicle::AddPassenger(), ASSERT, AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, ChangeSeat(), Dismount(), ExitVehicle(), Vehicle::GetBase(), Object::GetEntry(), AuraApplication::GetRemoveMode(), WorldObject::GetTransSeat(), GetVehicleKit(), InterruptNonMeleeSpells(), IsAlive(), IsOnVehicle(), Object::IsPlayer(), LOG_DEBUG, m_vehicle, RemoveAurasByType(), RemoveAurasWithInterruptFlags(), SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SPELL_AURA_MOUNTED, sScriptMgr, and Object::ToPlayer().

Referenced by AuraEffect::HandleAuraControlVehicle().

◆ _ExitVehicle()

void Unit::_ExitVehicle ( Position const *  exitPosition = nullptr)
19680{
19681 if (!m_vehicle)
19682 return;
19683
19685
19686 Player* player = ToPlayer();
19687
19688 // If player is on mouted duel and exits the mount should immediatly lose the duel
19689 if (player && player->duel && player->duel->IsMounted)
19690 player->DuelComplete(DUEL_FLED);
19691
19692 // This should be done before dismiss, because there may be some aura removal
19693 Vehicle* vehicle = m_vehicle;
19694 Unit* vehicleBase = m_vehicle->GetBase();
19695 m_vehicle = nullptr;
19696
19697 if (!vehicleBase)
19698 return;
19699
19700 SetControlled(false, UNIT_STATE_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT
19701
19702 Position pos;
19703 if (!exitPosition) // Exit position not specified
19704 pos = vehicleBase->GetPosition(); // This should use passenger's current position, leaving it as it is now
19705 // because we calculate positions incorrect (sometimes under map)
19706 else
19707 pos = *exitPosition;
19708
19709 // HACK
19710 VehicleEntry const* vehicleInfo = vehicle->GetVehicleInfo();
19711 if (vehicleInfo)
19712 {
19713 if (vehicleInfo->m_ID == 380) // Kologarn right arm
19714 {
19715 pos.Relocate(1776.0f, -24.0f, 448.75f, 0.0f);
19716 }
19717 else if (vehicleInfo->m_ID == 91) // Helsman's Ship
19718 {
19719 pos.Relocate(2802.18f, 7054.91f, -0.6f, 4.67f);
19720 }
19721 else if (vehicleInfo->m_ID == 349) // AT Mounts, dismount to the right
19722 {
19723 float x = pos.GetPositionX() + 2.0f * cos(pos.GetOrientation() - M_PI / 2.0f);
19724 float y = pos.GetPositionY() + 2.0f * std::sin(pos.GetOrientation() - M_PI / 2.0f);
19725 float z = GetMapHeight(x, y, pos.GetPositionZ());
19726 if (z > INVALID_HEIGHT)
19727 {
19728 pos.Relocate(x, y, z);
19729 }
19730 }
19731 }
19732
19734
19735 if (player)
19736 {
19738
19739 sScriptMgr->AnticheatSetUnderACKmount(player);
19740 }
19742 {
19744 data << GetPackGUID();
19745 SendMessageToSet(&data, false);
19746 }
19747
19748 // xinef: hack for flameleviathan seat vehicle
19749 if (!vehicleInfo || vehicleInfo->m_ID != 341)
19750 {
19751 Movement::MoveSplineInit init(this);
19752 init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
19753 init.SetFacing(GetOrientation());
19754 init.SetTransportExit();
19755 init.Launch();
19756 }
19757 else
19758 {
19759 float o = pos.GetAngle(this);
19760 Movement::MoveSplineInit init(this);
19761 init.MoveTo(pos.GetPositionX() + 8 * cos(o), pos.GetPositionY() + 8 * std::sin(o), pos.GetPositionZ() + 16.0f);
19762 init.SetFacing(GetOrientation());
19763 init.SetTransportExit();
19764 init.Launch();
19765 DisableSpline();
19766 KnockbackFrom(pos.GetPositionX(), pos.GetPositionY(), 10.0f, 20.0f);
19768 }
19769
19770 // xinef: move fall, should we support all creatures that exited vehicle in air? Currently Quest Drag and Drop only, Air Assault quest
19771 if (GetTypeId() == TYPEID_UNIT && !CanFly() && vehicleInfo && (vehicleInfo->m_ID == 113 || vehicleInfo->m_ID == 8 || vehicleInfo->m_ID == 290 || vehicleInfo->m_ID == 298))
19772 {
19774 }
19775
19776 if ((!player || !(player->GetDelayedOperations() & DELAYED_VEHICLE_TELEPORT)) && vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
19777 if (((Minion*)vehicleBase)->GetOwner() == this)
19778 {
19779 if (!vehicleInfo || vehicleInfo->m_ID != 349)
19780 {
19781 vehicle->Dismiss();
19782 }
19783 else if (vehicleBase->GetTypeId() == TYPEID_UNIT)
19784 {
19785 vehicle->Uninstall();
19786 vehicleBase->m_Events.AddEvent(new VehicleDespawnEvent(*vehicleBase, 2000), vehicleBase->m_Events.CalculateTime(2000));
19787 }
19788
19789 // xinef: ugly hack, no appripriate hook later to cast spell
19790 if (player)
19791 {
19792 if (vehicleBase->GetEntry() == NPC_EIDOLON_WATCHER)
19793 player->CastSpell(player, VEHICLE_SPELL_SHADE_CONTROL_END, true);
19794 else if (vehicleBase->GetEntry() == NPC_LITHE_STALKER)
19795 player->CastSpell(player, VEHICLE_SPELL_GEIST_CONTROL_END, true);
19796 }
19797 }
19798
19800 {
19801 // Vehicle just died, we die too
19802 if (vehicleBase->getDeathState() == DeathState::JustDied)
19803 setDeathState(DeathState::JustDied);
19804 // If for other reason we as minion are exiting the vehicle (ejected, master dismounted) - unsummon
19805 else
19806 {
19807 SetVisible(false);
19808 ToTempSummon()->UnSummon(2000); // Approximation
19809 }
19810 }
19811
19812 if (player)
19813 {
19815 player->SetCanTeleport(true);
19816 }
19817}
#define INVALID_HEIGHT
Definition: Map.h:165
@ VEHICLE_SPELL_PARACHUTE
Definition: VehicleDefines.h:53
@ VEHICLE_SPELL_SHADE_CONTROL_END
Definition: VehicleDefines.h:56
@ VEHICLE_SPELL_GEIST_CONTROL_END
Definition: VehicleDefines.h:55
@ NPC_EIDOLON_WATCHER
Definition: VehicleDefines.h:61
@ NPC_LITHE_STALKER
Definition: VehicleDefines.h:62
@ DELAYED_VEHICLE_TELEPORT
Definition: Player.h:908
@ MOVEMENTFLAG_ROOT
Definition: UnitDefines.h:355
@ UNIT_MASK_ACCESSORY
Definition: UnitDefines.h:144
@ UNIT_MASK_MINION
Definition: UnitDefines.h:136
@ UNIT_STATE_ROOT
Definition: UnitDefines.h:159
@ UNIT_STATE_MOVE
Definition: UnitDefines.h:168
@ DUEL_FLED
Definition: SharedDefines.h:3614
@ SMSG_SPLINE_MOVE_UNROOT
Definition: Opcodes.h:802
Seconds GetGameTime()
Definition: GameTime.cpp:38
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.h:103
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:159
virtual void UnSummon(uint32 msTime=0)
Definition: TemporarySummon.cpp:282
Definition: TemporarySummon.h:76
PackedGuid const & GetPackGUID() const
Definition: Object.h:111
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:2080
float GetMapHeight(float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
Definition: Object.cpp:3115
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
void GetPosition(float &x, float &y) const
Definition: Position.h:122
float GetPositionY() const
Definition: Position.h:118
float GetAngle(const Position *pos) const
Definition: Position.cpp:77
void SetCanTeleport(bool value)
Definition: Player.h:2474
void DuelComplete(DuelCompleteType type)
Definition: Player.cpp:6366
void SetFallInformation(uint32 time, float z)
Definition: Player.h:2312
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1854
void ResummonPetTemporaryUnSummonedIfAny()
Definition: Player.cpp:14180
uint32 GetDelayedOperations() const
Definition: Player.h:2074
void SetVisible(bool x)
Definition: Unit.cpp:14161
virtual void setDeathState(DeathState s, bool despawn=false)
Definition: Unit.cpp:14479
Unit * GetOwner() const
Definition: Unit.cpp:10540
DeathState getDeathState()
Definition: Unit.h:1154
virtual bool CanFly() const =0
MotionMaster * GetMotionMaster()
Definition: Unit.h:1605
TempSummon * ToTempSummon()
Definition: Unit.h:1743
void DisableSpline()
Definition: Unit.cpp:637
void AddUnitState(uint32 f)
Definition: Unit.h:738
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:17951
EventProcessor m_Events
Definition: Unit.h:1437
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:1617
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1154
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:748
void KnockbackFrom(float x, float y, float speedXY, float speedZ)
Definition: Unit.cpp:19060
Definition: Vehicle.h:28
void Dismiss()
Definition: Vehicle.cpp:521
VehicleEntry const * GetVehicleInfo() const
Definition: Vehicle.h:38
void RemovePassenger(Unit *passenger)
Definition: Vehicle.cpp:442
void Uninstall()
Definition: Vehicle.cpp:97
Definition: Vehicle.h:100
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:624
Definition: MoveSplineInit.h:71
Definition: DBCStructure.h:2027
uint32 m_ID
Definition: DBCStructure.h:2028

References EventProcessor::AddEvent(), AddUnitState(), EventProcessor::CalculateTime(), CanFly(), CastSpell(), DELAYED_VEHICLE_TELEPORT, DisableSpline(), Vehicle::Dismiss(), Player::duel, DUEL_FLED, Player::DuelComplete(), Position::GetAngle(), Vehicle::GetBase(), getDeathState(), Player::GetDelayedOperations(), Object::GetEntry(), GameTime::GetGameTime(), WorldObject::GetMapHeight(), GetMotionMaster(), Position::GetOrientation(), GetOwner(), Object::GetPackGUID(), Position::GetPosition(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), Vehicle::GetVehicleInfo(), HasUnitMovementFlag(), HasUnitTypeMask(), INVALID_HEIGHT, KnockbackFrom(), Movement::MoveSplineInit::Launch(), m_Events, VehicleEntry::m_ID, m_vehicle, MotionMaster::MoveFall(), MOVEMENTFLAG_ROOT, Movement::MoveSplineInit::MoveTo(), NPC_EIDOLON_WATCHER, NPC_LITHE_STALKER, Position::Relocate(), Vehicle::RemovePassenger(), Player::ResummonPetTemporaryUnSummonedIfAny(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), SetControlled(), setDeathState(), Movement::MoveSplineInit::SetFacing(), Player::SetFallInformation(), Movement::MoveSplineInit::SetTransportExit(), SetVisible(), SMSG_SPLINE_MOVE_UNROOT, sScriptMgr, Object::ToPlayer(), ToTempSummon(), TYPEID_UNIT, Vehicle::Uninstall(), UNIT_MASK_ACCESSORY, UNIT_MASK_MINION, UNIT_STATE_MOVE, UNIT_STATE_ROOT, TempSummon::UnSummon(), VEHICLE_SPELL_GEIST_CONTROL_END, VEHICLE_SPELL_PARACHUTE, and VEHICLE_SPELL_SHADE_CONTROL_END.

Referenced by AuraEffect::HandleAuraControlVehicle(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ _IsNoStackAuraDueToAura()

bool Unit::_IsNoStackAuraDueToAura ( Aura appliedAura,
Aura existingAura 
) const

◆ _IsValidAssistTarget()

bool Unit::_IsValidAssistTarget ( Unit const *  target,
SpellInfo const *  bySpell 
) const
13930{
13931 ASSERT(target);
13932
13933 // can assist to self
13934 if (this == target)
13935 return true;
13936
13937 // can't assist unattackable units or GMs
13938 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13939 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
13940 return false;
13941
13942 // can't assist own vehicle or passenger
13943 if (m_vehicle)
13944 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13945 return false;
13946
13947 // can't assist invisible
13948 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()))
13949 return false;
13950
13951 // can't assist dead
13952 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13953 return false;
13954
13955 // can't assist untargetable
13956 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13957 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13958 return false;
13959
13960 if (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
13961 {
13962 // xinef: do not allow to assist non attackable units
13963 if (target->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
13964 return false;
13965
13967 {
13968 if (target->IsImmuneToPC())
13969 return false;
13970 }
13971 else
13972 {
13973 if (target->IsImmuneToNPC())
13974 return false;
13975 }
13976 }
13977
13978 // can't assist non-friendly targets
13979 if (GetReactionTo(target) < REP_NEUTRAL
13980 && target->GetReactionTo(this) < REP_NEUTRAL
13981 && (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)))
13982 return false;
13983
13984 // PvP case
13985 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
13986 {
13987 Player const* targetPlayerOwner = target->GetAffectingPlayer();
13989 {
13990 Player const* selfPlayerOwner = GetAffectingPlayer();
13991 if (selfPlayerOwner && targetPlayerOwner)
13992 {
13993 // can't assist player which is dueling someone
13994 if (selfPlayerOwner != targetPlayerOwner
13995 && targetPlayerOwner->duel)
13996 return false;
13997 }
13998 // can't assist player in ffa_pvp zone from outside
13999 if (target->IsFFAPvP() && !IsFFAPvP())
14000 return false;
14001
14002 // can't assist player out of sanctuary from sanctuary if has pvp enabled
14003 if (target->IsPvP())
14004 if (IsInSanctuary() && !target->IsInSanctuary())
14005 return false;
14006 }
14007 }
14008 // PvC case - player can assist creature only if has specific type flags
14009 // !target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) &&
14011 && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC))
14012 && !target->IsPvP())
14013 {
14014 if (Creature const* creatureTarget = target->ToCreature())
14015 return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_ASSIST;
14016 }
14017 return true;
14018}
@ UNIT_STATE_UNATTACKABLE
Definition: UnitDefines.h:186
@ UNIT_FLAG_NON_ATTACKABLE
Definition: UnitDefines.h:230
@ UNIT_FLAG_NOT_SELECTABLE
Definition: UnitDefines.h:254
@ UNIT_FLAG_PLAYER_CONTROLLED
Definition: UnitDefines.h:232
@ REP_NEUTRAL
Definition: SharedDefines.h:183
@ CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT
Definition: SharedDefines.h:2721
@ CREATURE_TYPE_FLAG_CAN_ASSIST
Definition: SharedDefines.h:2707
@ SPELL_ATTR6_CAN_TARGET_UNTARGETABLE
Definition: SharedDefines.h:628
@ SPELL_ATTR6_IGNORE_PHASE_SHIFT
Definition: SharedDefines.h:617
@ SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC
Definition: SharedDefines.h:607
Definition: Creature.h:46
Creature * ToCreature()
Definition: Object.h:201
bool CanSeeOrDetect(WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
Definition: Object.cpp:1726
ReputationRank GetReactionTo(Unit const *target, bool checkOriginalFaction=false) const
Definition: Unit.cpp:10006
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:825
bool IsInSanctuary() const
Definition: Unit.h:861
bool IsFFAPvP() const
Definition: Unit.h:863
Player * GetAffectingPlayer() const
Definition: Unit.cpp:10565

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_CAN_ASSIST, CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, GetAffectingPlayer(), Vehicle::GetBase(), GetReactionTo(), SpellInfo::HasAttribute(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsImmuneToNPC(), IsImmuneToPC(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), m_vehicle, REP_NEUTRAL, SPELL_ATTR6_CAN_ASSIST_IMMUNE_PC, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_STATE_UNATTACKABLE.

Referenced by SpellInfo::CheckExplicitTarget(), IsValidAssistTarget(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _IsValidAttackTarget()

bool Unit::_IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell,
WorldObject const *  obj = nullptr 
) const
13807{
13808 ASSERT(target);
13809
13810 // can't attack self
13811 if (this == target)
13812 return false;
13813
13814 // can't attack unattackable units or GMs
13815 if (target->HasUnitState(UNIT_STATE_UNATTACKABLE)
13816 || (target->IsPlayer() && target->ToPlayer()->IsGameMaster()))
13817 return false;
13818
13819 // can't attack own vehicle or passenger
13820 if (m_vehicle)
13821 if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
13822 if (!IsHostileTo(target)) // pussywizard: actually can attack own vehicle or passenger if it's hostile to us - needed for snobold in Gormok encounter
13823 return false;
13824
13825 // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
13826 //Ignore stealth if target is player and unit in combat with same player
13827 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_IGNORE_PHASE_SHIFT)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea()) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea()) || (target->IsPlayer() && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
13828 return false;
13829
13830 // can't attack dead
13831 if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->IsAlive())
13832 return false;
13833
13834 // can't attack untargetable
13835 if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_UNTARGETABLE))
13836 && target->HasUnitFlag(UNIT_FLAG_NOT_SELECTABLE))
13837 return false;
13838
13839 if (Player const* playerAttacker = ToPlayer())
13840 {
13841 if (playerAttacker->HasPlayerFlag(PLAYER_FLAGS_UBER) || playerAttacker->IsSpectator())
13842 return false;
13843 }
13844 // check flags
13846 || (!HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToNPC())
13847 || (!target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToNPC())
13848 || (HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && target->IsImmuneToPC())
13849 // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly
13850 || ((GetEntry() != WORLD_TRIGGER && (!obj || !obj->isType(TYPEMASK_GAMEOBJECT | TYPEMASK_DYNAMICOBJECT))) && target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && IsImmuneToPC()))
13851 return false;
13852
13853 // CvC case - can attack each other only when one of them is hostile
13855 return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE;
13856
13857 // PvP, PvC, CvP case
13858 // can't attack friendly targets
13859 ReputationRank repThisToTarget = GetReactionTo(target);
13860 ReputationRank repTargetToThis;
13861
13862 if (repThisToTarget > REP_NEUTRAL
13863 || (repTargetToThis = target->GetReactionTo(this)) > REP_NEUTRAL)
13864 return false;
13865
13866 // Not all neutral creatures can be attacked (even some unfriendly faction does not react aggresive to you, like Sporaggar)
13867 if (repThisToTarget == REP_NEUTRAL &&
13868 repTargetToThis <= REP_NEUTRAL)
13869 {
13870 Player* owner = GetAffectingPlayer();
13871 Unit const* const thisUnit = owner ? owner : this;
13872 if (!(target->IsPlayer() && thisUnit->IsPlayer()) &&
13873 !(target->GetTypeId() == TYPEID_UNIT && thisUnit->GetTypeId() == TYPEID_UNIT))
13874 {
13875 Player const* player = target->IsPlayer() ? target->ToPlayer() : thisUnit->ToPlayer();
13876 Unit const* creature = target->GetTypeId() == TYPEID_UNIT ? target : thisUnit;
13877
13878 if (FactionTemplateEntry const* factionTemplate = creature->GetFactionTemplateEntry())
13879 {
13880 if (!(player->GetReputationMgr().GetForcedRankIfAny(factionTemplate)))
13881 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplate->faction))
13882 if (FactionState const* repState = player->GetReputationMgr().GetState(factionEntry))
13883 if (!(repState->Flags & FACTION_FLAG_AT_WAR))
13884 return false;
13885 }
13886 }
13887 }
13888
13889 Creature const* creatureAttacker = ToCreature();
13890 if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT)
13891 return false;
13892
13893 Player const* playerAffectingAttacker = HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr;
13894 Player const* playerAffectingTarget = target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr;
13895
13896 // check duel - before sanctuary checks
13897 if (playerAffectingAttacker && playerAffectingTarget)
13898 if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->Opponent == playerAffectingTarget && playerAffectingAttacker->duel->State == DUEL_STATE_IN_PROGRESS)
13899 return true;
13900
13901 // PvP case - can't attack when attacker or target are in sanctuary
13902 // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp
13903 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary()))
13904 return false;
13905
13906 // additional checks - only PvP case
13907 if (playerAffectingAttacker && playerAffectingTarget)
13908 {
13909 if (!IsPvP() && bySpell && bySpell->IsAffectingArea() && !bySpell->HasAttribute(SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK))
13910 return false;
13911
13912 if (target->IsPvP())
13913 return true;
13914
13915 if (IsFFAPvP() && target->IsFFAPvP())
13916 return true;
13917
13919 }
13920 return true;
13921}
DBCStorage< FactionEntry > sFactionStore(FactionEntryfmt)
@ TYPEMASK_DYNAMICOBJECT
Definition: ObjectGuid.h:52
@ TYPEMASK_GAMEOBJECT
Definition: ObjectGuid.h:51
@ UNIT_FIELD_BYTES_2
Definition: UpdateFields.h:161
@ DUEL_STATE_IN_PROGRESS
Definition: Player.h:372
@ PLAYER_FLAGS_UBER
Definition: Player.h:493
#define WORLD_TRIGGER
Definition: Unit.h:37
@ UNIT_BYTE2_FLAG_UNK1
Definition: UnitDefines.h:116
@ UNIT_FLAG_TAXI_FLIGHT
Definition: UnitDefines.h:249
@ UNIT_FLAG_NON_ATTACKABLE_2
Definition: UnitDefines.h:245
@ UNIT_FLAG_NOT_ATTACKABLE_1
Definition: UnitDefines.h:236
@ FACTION_FLAG_AT_WAR
Definition: DBCEnums.h:308
@ SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK
Definition: SharedDefines.h:573
ReputationRank
Definition: SharedDefines.h:179
@ REP_HOSTILE
Definition: SharedDefines.h:181
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:206
uint32 type_flags
Definition: CreatureData.h:226
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
Definition: Object.cpp:949
ReputationMgr & GetReputationMgr()
Definition: Player.h:2101
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition: Unit.cpp:9976
bool IsPvP() const
Definition: Unit.h:862
bool IsInCombatWith(Unit const *who) const
Definition: Unit.cpp:20941
bool IsImmuneToNPC() const
Definition: Unit.h:1027
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10178
bool IsImmuneToPC() const
Definition: Unit.h:1025
Definition: ReputationMgr.h:42
FactionState const * GetState(FactionEntry const *factionEntry) const
Definition: ReputationMgr.h:82
ReputationRank const * GetForcedRankIfAny(FactionTemplateEntry const *factionTemplateEntry) const
Definition: ReputationMgr.h:107
Definition: DBCStructure.h:907
Definition: DBCStructure.h:939

References ASSERT, WorldObject::CanSeeOrDetect(), CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_FLAG_AT_WAR, GetAffectingPlayer(), Vehicle::GetBase(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetReactionTo(), Player::GetReputationMgr(), ReputationMgr::GetState(), Object::GetTypeId(), SpellInfo::HasAttribute(), Object::HasByteFlag(), HasStealthAura(), HasUnitFlag(), HasUnitState(), SpellInfo::IsAffectingArea(), IsAlive(), SpellInfo::IsAllowingDeadTarget(), IsFFAPvP(), Player::IsGameMaster(), IsHostileTo(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsInCombatWith(), IsInSanctuary(), IsOnVehicle(), Object::IsPlayer(), IsPvP(), Object::isType(), m_vehicle, PLAYER_FLAGS_UBER, REP_HOSTILE, REP_NEUTRAL, sFactionStore, SPELL_ATTR5_IGNORE_AREA_EFFECT_PVP_CHECK, SPELL_ATTR6_CAN_TARGET_UNTARGETABLE, SPELL_ATTR6_IGNORE_PHASE_SHIFT, Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, TYPEID_UNIT, TYPEMASK_DYNAMICOBJECT, TYPEMASK_GAMEOBJECT, UNIT_BYTE2_FLAG_UNK1, UNIT_FIELD_BYTES_2, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NON_ATTACKABLE_2, UNIT_FLAG_NOT_ATTACKABLE_1, UNIT_FLAG_NOT_SELECTABLE, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_TAXI_FLIGHT, UNIT_STATE_UNATTACKABLE, and WORLD_TRIGGER.

Referenced by SpellInfo::CheckExplicitTarget(), Spell::DoSpellHitOnUnit(), GetMagicHitRedirectTarget(), GetMeleeHitRedirectTarget(), IsValidAttackTarget(), Acore::AnyAoETargetUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ _RegisterAuraEffect()

void Unit::_RegisterAuraEffect ( AuraEffect aurEff,
bool  apply 
)
4659{
4660 if (apply)
4661 m_modAuras[aurEff->GetAuraType()].push_back(aurEff);
4662 else
4663 m_modAuras[aurEff->GetAuraType()].remove(aurEff);
4664}
AuraEffectList m_modAuras[TOTAL_AURAS]
Definition: Unit.h:1852
AuraType GetAuraType() const
Definition: SpellAuraEffects.cpp:447

References AuraEffect::GetAuraType(), and m_modAuras.

Referenced by AuraEffect::HandleEffect().

◆ _RegisterDynObject()

void Unit::_RegisterDynObject ( DynamicObject dynObj)
6070{
6071 m_dynObj.push_back(dynObj);
6072}

References m_dynObj.

Referenced by DynamicObject::BindToCaster().

◆ _RemoveAllAuraStatMods()

void Unit::_RemoveAllAuraStatMods ( )
5434{
5435 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
5436 (*i).second->GetBase()->HandleAllEffects(i->second, AURA_EFFECT_HANDLE_STAT, false);
5437}

References AURA_EFFECT_HANDLE_STAT, and m_appliedAuras.

Referenced by Player::_RemoveAllStatBonuses().

◆ _removeAttacker()

void Unit::_removeAttacker ( Unit pAttacker)
inline
703 {
704 m_attackers.erase(pAttacker);
705 }

References m_attackers.

Referenced by Attack(), and AttackStop().

◆ _RemoveNoStackAuraApplicationsDueToAura()

void Unit::_RemoveNoStackAuraApplicationsDueToAura ( Aura aura)

◆ _RemoveNoStackAurasDueToAura()

void Unit::_RemoveNoStackAurasDueToAura ( Aura aura)
4630{
4631 //SpellInfo const* spellProto = aura->GetSpellInfo();
4632
4633 // passive spell special case (only non stackable with ranks)
4634
4635 // xinef: this check makes caster to have 2 area auras thanks to spec switch
4636 // if (spellProto->IsPassiveStackableWithRanks())
4637 // return;
4638
4639 bool remove = false;
4640 for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i)
4641 {
4642 if (remove)
4643 {
4644 remove = false;
4645 i = m_appliedAuras.begin();
4646 }
4647
4648 if (aura->CanStackWith(i->second->GetBase(), true))
4649 continue;
4650
4652 if (i == m_appliedAuras.end())
4653 break;
4654 remove = true;
4655 }
4656}
@ AURA_REMOVE_BY_DEFAULT
Definition: SpellAuraDefines.h:392
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4738
bool CanStackWith(Aura const *checkAura, bool remove) const
Definition: SpellAuras.cpp:2021

References AURA_REMOVE_BY_DEFAULT, Aura::CanStackWith(), m_appliedAuras, and RemoveAura().

Referenced by _AddAura(), and _ApplyAura().

◆ _TryStackingOrRefreshingExistingAura()

Aura * Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const *  newAura,
uint8  effMask,
Unit caster,
int32 baseAmount = nullptr,
Item castItem = nullptr,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool  periodicReset = false 
)
4320{
4321 ASSERT(casterGUID || caster);
4322 if (!casterGUID)
4323 casterGUID = caster->GetGUID();
4324
4325 // Xinef: Hax for mixology, best solution qq
4326 if (sSpellMgr->GetSpellGroup(newAura->Id) == 1)
4327 return nullptr;
4328
4329 // passive and Incanter's Absorption and auras with different type can stack with themselves any number of times
4330 if (!newAura->IsMultiSlotAura())
4331 {
4332 // check if cast item changed
4333 ObjectGuid castItemGUID;
4334 if (castItem)
4335 castItemGUID = castItem->GetGUID();
4336
4337 // find current aura from spell and change it's stackamount, or refresh it's duration
4338 if (Aura* foundAura = GetOwnedAura(newAura->Id, newAura->HasAttribute(SPELL_ATTR0_CU_SINGLE_AURA_STACK) ? ObjectGuid::Empty : casterGUID, newAura->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC) ? castItemGUID : ObjectGuid::Empty, 0))
4339 {
4340 // effect masks do not match
4341 // extremely rare case
4342 // let's just recreate aura
4343 if (effMask != foundAura->GetEffectMask())
4344 return nullptr;
4345
4346 // update basepoints with new values - effect amount will be recalculated in ModStackAmount
4347 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4348 {
4349 if (!foundAura->HasEffect(i))
4350 continue;
4351
4352 int bp;
4353 if (baseAmount)
4354 bp = *(baseAmount + i);
4355 else
4356 bp = foundAura->GetSpellInfo()->Effects[i].BasePoints;
4357
4358 int32* oldBP = const_cast<int32*>(&(foundAura->GetEffect(i)->m_baseAmount));
4359 *oldBP = bp;
4360 }
4361
4362 // correct cast item guid if needed
4363 if (castItemGUID != foundAura->GetCastItemGUID())
4364 {
4365 ObjectGuid* oldGUID = const_cast<ObjectGuid*>(&foundAura->m_castItemGuid);
4366 *oldGUID = castItemGUID;
4367 }
4368
4369 // try to increase stack amount
4370 foundAura->ModStackAmount(1, AURA_REMOVE_BY_DEFAULT, periodicReset);
4371 sScriptMgr->OnAuraApply(this, foundAura);
4372 return foundAura;
4373 }
4374 }
4375
4376 return nullptr;
4377}
#define sSpellMgr
Definition: SpellMgr.h:825
@ SPELL_ATTR0_CU_ENCHANT_PROC
Definition: SpellInfo.h:176
@ SPELL_ATTR0_CU_SINGLE_AURA_STACK
Definition: SpellInfo.h:198
std::int32_t int32
Definition: Define.h:103
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
Definition: ObjectGuid.h:118
static ObjectGuid const Empty
Definition: ObjectGuid.h:120
Aura * GetOwnedAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, Aura *except=nullptr) const
Definition: Unit.cpp:4722

References ASSERT, AURA_REMOVE_BY_DEFAULT, ObjectGuid::Empty, Object::GetGUID(), GetOwnedAura(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsMultiSlotAura(), MAX_SPELL_EFFECTS, SPELL_ATTR0_CU_ENCHANT_PROC, SPELL_ATTR0_CU_SINGLE_AURA_STACK, sScriptMgr, and sSpellMgr.

Referenced by Aura::TryRefreshStackOrCreate().

◆ _UnapplyAura() [1/2]

void Unit::_UnapplyAura ( AuraApplication aurApp,
AuraRemoveMode  removeMode 
)
4609{
4610 // aura can be removed from unit only if it's applied on it, shouldn't happen
4611 ASSERT(aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) == aurApp);
4612
4613 uint32 spellId = aurApp->GetBase()->GetId();
4614 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4615
4616 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4617 {
4618 if (iter->second == aurApp)
4619 {
4620 _UnapplyAura(iter, removeMode);
4621 return;
4622 }
4623 else
4624 ++iter;
4625 }
4626 ABORT();
4627}
#define ABORT
Definition: Errors.h:76
std::pair< AuraApplicationMap::iterator, AuraApplicationMap::iterator > AuraApplicationMapBoundsNonConst
Definition: Unit.h:641
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition: Unit.cpp:4516

References _UnapplyAura(), ABORT, ASSERT, Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), and m_appliedAuras.

◆ _UnapplyAura() [2/2]

void Unit::_UnapplyAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  removeMode 
)
4517{
4518 AuraApplication* aurApp = i->second;
4519 ASSERT(aurApp);
4520 ASSERT(!aurApp->GetRemoveMode());
4521 ASSERT(aurApp->GetTarget() == this);
4522
4523 aurApp->SetRemoveMode(removeMode);
4524 Aura* aura = aurApp->GetBase();
4525 LOG_DEBUG("spells.aura", "Aura {} now is remove mode {}", aura->GetId(), removeMode);
4526
4527 // dead loop is killing the server probably
4528 ASSERT(m_removedAurasCount < 0xFFFFFFFF);
4529
4531
4532 Unit* caster = aura->GetCaster();
4533
4534 // Remove all pointers from lists here to prevent possible pointer invalidation on spellcast/auraapply/auraremove
4535 m_appliedAuras.erase(i);
4536
4537 // xinef: do not insert our application to interruptible list if application target is not the owner (area auras)
4538 // xinef: event if it gets removed, it will be reapplied in a second
4539 if (aura->GetSpellInfo()->AuraInterruptFlags && this == aura->GetOwner())
4540 {
4541 m_interruptableAuras.remove(aurApp);
4543 }
4544
4545 bool auraStateFound = false;
4546 AuraStateType auraState = aura->GetSpellInfo()->GetAuraState();
4547 if (auraState)
4548 {
4549 bool canBreak = false;
4550 // Get mask of all aurastates from remaining auras
4551 for (AuraStateAurasMap::iterator itr = m_auraStateAuras.lower_bound(auraState); itr != m_auraStateAuras.upper_bound(auraState) && !(auraStateFound && canBreak);)
4552 {
4553 if (itr->second == aurApp)
4554 {
4555 m_auraStateAuras.erase(itr);
4556 itr = m_auraStateAuras.lower_bound(auraState);
4557 canBreak = true;
4558 continue;
4559 }
4560 auraStateFound = true;
4561 ++itr;
4562 }
4563 }
4564
4565 aurApp->_Remove();
4566 aura->_UnapplyForTarget(this, caster, aurApp);
4567
4568 // remove effects of the spell - needs to be done after removing aura from lists
4569 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4570 {
4571 if (aurApp->HasEffect(itr))
4572 aurApp->_HandleEffect(itr, false);
4573 }
4574
4575 // all effect mustn't be applied
4576 ASSERT(!aurApp->GetEffectMask());
4577
4578 // Remove totem at next update if totem loses its aura
4579 if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE && IsTotem() && GetGUID() == aura->GetCasterGUID())
4580 {
4581 if (ToTotem()->GetSpell() == aura->GetId() && ToTotem()->GetTotemType() == TOTEM_PASSIVE)
4582 ToTotem()->setDeathState(DeathState::JustDied);
4583 }
4584
4585 // Remove aurastates only if needed and were not found
4586 if (auraState)
4587 {
4588 if (!auraStateFound)
4589 ModifyAuraState(auraState, false);
4590 else
4591 {
4592 // update for casters, some shouldn't 'see' the aura state
4593 uint32 aStateMask = (1 << (auraState - 1));
4594 if ((aStateMask & PER_CASTER_AURA_STATE_MASK) != 0)
4596 }
4597 }
4598
4599 aura->HandleAuraSpecificMods(aurApp, caster, false, false);
4600
4601 // only way correctly remove all auras from list
4602 //if (removedAuras != m_removedAurasCount) new aura may be added
4603 i = m_appliedAuras.begin();
4604
4605 sScriptMgr->OnAuraRemove(this, aurApp, removeMode);
4606}
@ AURA_REMOVE_BY_EXPIRE
Definition: SpellAuraDefines.h:395
@ TOTEM_PASSIVE
Definition: Totem.h:25
void setDeathState(DeathState s, bool despawn=false) override
A creature can be in 4 different states: Alive, JustDied, Corpse, and JustRespawned....
Definition: TemporarySummon.cpp:395
Totem * ToTotem()
Definition: Unit.h:1742
void UpdateInterruptMask()
Definition: Unit.cpp:741
bool IsTotem() const
Definition: Unit.h:756
Unit * GetTarget() const
Definition: SpellAuras.h:61
void SetRemoveMode(AuraRemoveMode mode)
Definition: SpellAuras.h:72
void _Remove()
Definition: SpellAuras.cpp:94
bool HasEffect(uint8 effect) const
Definition: SpellAuras.h:67
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:515

References AuraApplication::_HandleEffect(), AuraApplication::_Remove(), Aura::_UnapplyForTarget(), ASSERT, AURA_REMOVE_BY_EXPIRE, SpellInfo::AuraInterruptFlags, Object::ForceValuesUpdateAtIndex(), SpellInfo::GetAuraState(), AuraApplication::GetBase(), Aura::GetCaster(), Aura::GetCasterGUID(), AuraApplication::GetEffectMask(), Object::GetGUID(), Aura::GetId(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), Aura::GetSpellInfo(), AuraApplication::GetTarget(), Aura::HandleAuraSpecificMods(), AuraApplication::HasEffect(), IsTotem(), LOG_DEBUG, m_appliedAuras, m_auraStateAuras, m_interruptableAuras, m_removedAurasCount, MAX_SPELL_EFFECTS, ModifyAuraState(), PER_CASTER_AURA_STATE_MASK, Minion::setDeathState(), AuraApplication::SetRemoveMode(), sScriptMgr, TOTEM_PASSIVE, ToTotem(), UNIT_FIELD_AURASTATE, and UpdateInterruptMask().

Referenced by Aura::_Remove(), _UnapplyAura(), RemoveAllAuras(), RemoveAllAurasExceptType(), RemoveAllAurasOnDeath(), RemoveAllAurasRequiringDeadTarget(), RemoveAura(), and RemoveEvadeAuras().

◆ _UnregisterDynObject()

void Unit::_UnregisterDynObject ( DynamicObject dynObj)
6075{
6076 m_dynObj.remove(dynObj);
6077}

References m_dynObj.

Referenced by DynamicObject::UnbindFromCaster().

◆ _UpdateAutoRepeatSpell()

void Unit::_UpdateAutoRepeatSpell ( )
protected
3870{
3871 SpellInfo const* spellProto = nullptr;
3873 {
3875 }
3876
3877 if (!spellProto)
3878 {
3879 return;
3880 }
3881
3882 static uint32 const HUNTER_AUTOSHOOT = 75;
3883
3884 // Check "realtime" interrupts
3885 if ((IsPlayer() && ToPlayer()->isMoving()) || IsNonMeleeSpellCast(false, false, true, spellProto->Id == HUNTER_AUTOSHOOT))
3886 {
3887 // cancel wand shoot
3888 if (spellProto->Id != HUNTER_AUTOSHOOT)
3890 m_AutoRepeatFirstCast = true;
3891 return;
3892 }
3893
3895 {
3897 }
3898
3899 m_AutoRepeatFirstCast = false;
3900
3901 // Check for ranged attack timer
3903 {
3905 if (result != SPELL_CAST_OK)
3906 {
3907 if (spellProto->Id != HUNTER_AUTOSHOOT)
3908 {
3910 }
3911
3912 return;
3913 }
3914
3915 // We want to shoot
3916 Spell* spell = new Spell(this, spellProto, TRIGGERED_FULL_MASK);
3917 spell->prepare(&(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_targets));
3918
3919 // Reset attack
3921 }
3922}
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:148
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:540
SpellCastResult
Definition: SharedDefines.h:948
@ SPELL_CAST_OK
Definition: SharedDefines.h:1138
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, bool bySelf=false)
Definition: Unit.cpp:4027
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:4064
void setAttackTimer(WeaponAttackType type, int32 time)
Definition: Unit.h:680
bool isMoving() const
Definition: Unit.h:1723
int32 getAttackTimer(WeaponAttackType type) const
Definition: Unit.h:682
bool isAttackReady(WeaponAttackType type=BASE_ATTACK) const
Definition: Unit.h:683
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition: Unit.cpp:643
Definition: Spell.h:284
SpellCastResult prepare(SpellCastTargets const *targets, AuraEffect const *triggeredByAura=nullptr)
Definition: Spell.cpp:3467
SpellCastResult CheckCast(bool strict)
Definition: Spell.cpp:5643
SpellInfo const *const m_spellInfo
Definition: Spell.h:520

References Spell::CheckCast(), CURRENT_AUTOREPEAT_SPELL, getAttackTimer(), SpellInfo::Id, InterruptSpell(), isAttackReady(), isMoving(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_spellInfo, Spell::prepare(), RANGED_ATTACK, resetAttackTimer(), setAttackTimer(), SPELL_CAST_OK, Object::ToPlayer(), and TRIGGERED_FULL_MASK.

Referenced by _UpdateSpells().

◆ _UpdateSpells()

void Unit::_UpdateSpells ( uint32  time)
protected
3812{
3815
3816 // remove finished spells from current pointers
3817 for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
3818 {
3819 if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
3820 {
3822 m_currentSpells[i] = nullptr; // remove pointer
3823 }
3824 }
3825
3826 // m_auraUpdateIterator can be updated in indirect called code at aura remove to skip next planned to update but removed auras
3828 {
3829 Aura* i_aura = m_auraUpdateIterator->second;
3830 ++m_auraUpdateIterator; // need shift to next for allow update if need into aura update
3831 i_aura->UpdateOwner(time, this);
3832 }
3833
3834 // remove expired auras - do that after updates(used in scripts?)
3835 for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();)
3836 {
3837 if (i->second->IsExpired())
3839 else if (i->second->GetSpellInfo()->IsChanneled() && i->second->GetCasterGUID() != GetGUID() && !ObjectAccessor::GetWorldObject(*this, i->second->GetCasterGUID()))
3840 RemoveOwnedAura(i, AURA_REMOVE_BY_CANCEL); // remove channeled auras when caster is not on the same map
3841 else
3842 ++i;
3843 }
3844
3845 for (VisibleAuraMap::iterator itr = m_visibleAuras.begin(); itr != m_visibleAuras.end(); ++itr)
3846 if (itr->second->IsNeedClientUpdate())
3847 itr->second->ClientUpdate();
3848
3850
3851 if (!m_gameObj.empty())
3852 {
3853 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
3854 {
3855 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
3856 if (!go->isSpawned())
3857 {
3858 go->SetOwnerGUID(ObjectGuid::Empty);
3859 go->SetRespawnTime(0);
3860 go->Delete();
3861 m_gameObj.erase(itr++);
3862 continue;
3863 }
3864 ++itr;
3865 }
3866 }
3867}
@ SPELL_STATE_FINISHED
Definition: Spell.h:226
@ AURA_REMOVE_BY_CANCEL
Definition: SpellAuraDefines.h:393
GameObject * GetGameObject(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:187
WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:118
Definition: GameObject.h:121
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4667
void _UpdateAutoRepeatSpell()
Definition: Unit.cpp:3869
VisibleAuraMap m_visibleAuras
Definition: Unit.h:1861
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: SpellAuras.cpp:756

References _DeleteRemovedAuras(), _UpdateAutoRepeatSpell(), AURA_REMOVE_BY_CANCEL, AURA_REMOVE_BY_EXPIRE, CURRENT_AUTOREPEAT_SPELL, CURRENT_MAX_SPELL, ObjectGuid::Empty, ObjectAccessor::GetGameObject(), Object::GetGUID(), ObjectAccessor::GetWorldObject(), m_auraUpdateIterator, m_currentSpells, m_gameObj, m_ownedAuras, m_visibleAuras, RemoveOwnedAura(), Spell::SetReferencedFromCurrent(), SPELL_STATE_FINISHED, and Aura::UpdateOwner().

Referenced by Update().

◆ AddAura() [1/2]

Aura * Unit::AddAura ( SpellInfo const *  spellInfo,
uint8  effMask,
Unit target 
)
18796{
18797 if (!spellInfo)
18798 return nullptr;
18799
18800 if (target->IsImmunedToSpell(spellInfo))
18801 return nullptr;
18802
18803 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
18804 {
18805 if (!(effMask & (1 << i)))
18806 continue;
18807 if (target->IsImmunedToSpellEffect(spellInfo, i))
18808 effMask &= ~(1 << i);
18809 }
18810
18811 if (Aura* aura = Aura::TryRefreshStackOrCreate(spellInfo, effMask, target, this))
18812 {
18813 aura->ApplyForTargets();
18814 return aura;
18815 }
18816 return nullptr;
18817}
virtual bool IsImmunedToSpellEffect(SpellInfo const *spellInfo, uint32 index) const
Definition: Unit.cpp:12941
virtual bool IsImmunedToSpell(SpellInfo const *spellInfo, Spell const *spell=nullptr)
Definition: Unit.cpp:12851
static Aura * TryRefreshStackOrCreate(SpellInfo const *spellproto, uint8 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=nullptr, bool periodicReset=false)
Definition: SpellAuras.cpp:326

References Aura::ApplyForTargets(), IsImmunedToSpell(), IsImmunedToSpellEffect(), MAX_SPELL_EFFECTS, and Aura::TryRefreshStackOrCreate().

◆ AddAura() [2/2]

Aura * Unit::AddAura ( uint32  spellId,
Unit target 
)
18781{
18782 if (!target)
18783 return nullptr;
18784
18785 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
18786 if (!spellInfo)
18787 return nullptr;
18788
18789 if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
18790 return nullptr;
18791
18792 return AddAura(spellInfo, MAX_EFFECT_MASK, target);
18793}
#define MAX_EFFECT_MASK
Definition: DBCStructure.h:1638
@ SPELL_ATTR2_ALLOW_DEAD_TARGET
Definition: SharedDefines.h:456
@ SPELL_ATTR0_PASSIVE
Definition: SharedDefines.h:388
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:18780
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:415

References AddAura(), SpellInfo::HasAttribute(), IsAlive(), MAX_EFFECT_MASK, SPELL_ATTR0_PASSIVE, SPELL_ATTR2_ALLOW_DEAD_TARGET, and sSpellMgr.

Referenced by AddAura(), boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::AttackStart(), boss_anzu::boss_anzu(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoTriggersOnSpellHit(), npc_anubisath_sentinel::aqsentinelAI::GainSentinelAbility(), AuraEffect::HandleAuraDummy(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterAdd(), gm_commandscript::HandleGMVisibleCommand(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_transitus_shield_beam_aura::HandleOnEffectApply(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Guardian::InitStatsForLevel(), boss_gahzranka::boss_gahzrankaAI::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), npc_dalaran_warrior::npc_dalaran_warriorAI::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Creature::LoadCreaturesAddon(), npc_brew_bubble::MoveInLineOfSight(), npc_pet_gen_plump_turkey::MovementInform(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_empowered_aura::OnPeriodic(), instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter(), BattlefieldWG::OnPlayerEnterZone(), AreaTrigger_at_area_52_entrance::OnTrigger(), Player::ProcessDelayedOperations(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_corrupted_totem::Reset(), npc_troll_volunteer::npc_troll_volunteerAI::Reset(), npc_vengeful_shade::npc_vengeful_shadeAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_magus_telestra::boss_magus_telestraAI::Reset(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_archavon::boss_archavonAI::Reset(), boss_emalon::boss_emalonAI::Reset(), boss_koralon::boss_koralonAI::Reset(), boss_toravon::boss_toravonAI::Reset(), npc_dalaran_mage::npc_dalaran_mageAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), npc_pet_pri_shadowfiend::Reset(), Player::SendInitialPacketsAfterAddToMap(), npc_corrupted_totem::SetAura(), SetAuraStack(), Player::SetGMVisible(), Player::SetIsSpectator(), npc_artorius::npc_artoriusAI::SpellHit(), npc_simone::npc_simoneAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::SpellHitTarget(), Spell::SummonGuardian(), boss_netherspite::SwitchToPortalPhase(), boss_gyth::boss_gythAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), boss_netherspite::UpdatePortals(), and npc_emily::npc_emilyAI::WaypointReached().

◆ AddComboPointHolder()

void Unit::AddComboPointHolder ( Unit unit)
inline
1642{ m_ComboPointHolders.insert(unit); }
std::unordered_set< Unit * > m_ComboPointHolders
Definition: Unit.h:1930

References m_ComboPointHolders.

Referenced by AddComboPoints().

◆ AddComboPoints() [1/2]

void Unit::AddComboPoints ( int8  count)
inline
1638{ AddComboPoints(nullptr, count); }
void AddComboPoints(Unit *target, int8 count)
Definition: Unit.cpp:16766

References AddComboPoints().

Referenced by AddComboPoints().

◆ AddComboPoints() [2/2]

void Unit::AddComboPoints ( Unit target,
int8  count 
)
16767{
16768 if (!count)
16769 {
16770 return;
16771 }
16772
16773 if (target && target != m_comboTarget)
16774 {
16775 if (m_comboTarget)
16776 {
16778 }
16779
16780 m_comboTarget = target;
16781 m_comboPoints = count;
16782 target->AddComboPointHolder(this);
16783 }
16784 else
16785 {
16786 m_comboPoints = std::max<int8>(std::min<int8>(m_comboPoints + count, 5), 0);
16787 }
16788
16790}
void SendComboPoints()
Definition: Unit.cpp:16809
void AddComboPointHolder(Unit *unit)
Definition: Unit.h:1642
void RemoveComboPointHolder(Unit *unit)
Definition: Unit.h:1643

References AddComboPointHolder(), m_comboPoints, m_comboTarget, RemoveComboPointHolder(), and SendComboPoints().

Referenced by Spell::_handle_finish_phase(), AuraEffect::HandleAuraRetainComboPoints(), and ProcDamageAndSpellFor().

◆ AddExtraAttacks()

void Unit::AddExtraAttacks ( uint32  count)
2733{
2735 if (!targetGUID)
2736 {
2737 if (ObjectGuid selection = GetTarget())
2738 {
2739 targetGUID = selection; // Spell was cast directly (not triggered by aura)
2740 }
2741 else
2742 return;
2743 }
2744
2745 extraAttacksTargets[targetGUID] += count;
2746}
std::unordered_map< ObjectGuid, uint32 > extraAttacksTargets
Definition: Unit.h:1943
ObjectGuid _lastDamagedTargetGuid
Definition: Unit.h:1944
ObjectGuid GetTarget() const
Definition: Unit.h:1776

References _lastDamagedTargetGuid, extraAttacksTargets, and GetTarget().

Referenced by Spell::EffectAddExtraAttacks().

◆ AddExtraUnitMovementFlag()

void Unit::AddExtraUnitMovementFlag ( uint16  f)
inline
1621{ m_movementInfo.flags2 |= f; }
uint16 flags2
Definition: Object.h:278
MovementInfo m_movementInfo
Definition: Object.h:607

References MovementInfo::flags2, and WorldObject::m_movementInfo.

Referenced by Vehicle::InitMovementInfoForBase().

◆ addFollower()

void Unit::addFollower ( FollowerReference pRef)
inline
void insertFirst(LinkedListElement *pElem)
Definition: LinkedList.h:105
FollowerRefMgr m_FollowingRefMgr
Definition: Unit.h:1926

References LinkedListHead::insertFirst(), and m_FollowingRefMgr.

Referenced by FollowerReference::targetObjectBuildLink().

◆ AddGameObject()

void Unit::AddGameObject ( GameObject gameObj)
6131{
6132 if (!gameObj || gameObj->GetOwnerGUID())
6133 return;
6134
6135 m_gameObj.push_back(gameObj->GetGUID());
6136 gameObj->SetOwnerGUID(GetGUID());
6137
6138 if (IsPlayer() && gameObj->GetSpellId())
6139 {
6140 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(gameObj->GetSpellId());
6141 // Need disable spell use for owner
6142 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6143 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6144 ToPlayer()->AddSpellAndCategoryCooldowns(createBySpell, 0, nullptr, true);
6145 }
6146}
uint32 GetSpellId() const
Definition: GameObject.h:182
void SetOwnerGUID(ObjectGuid owner)
Definition: GameObject.h:164
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:174
void AddSpellAndCategoryCooldowns(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool infinityCooldown=false)
Definition: Player.cpp:10863
bool IsCooldownStartedOnEvent() const
Definition: SpellInfo.cpp:1211

References Player::AddSpellAndCategoryCooldowns(), Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, GameObject::SetOwnerGUID(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::EffectDuel(), Spell::EffectSummonObject(), Spell::EffectTransmitted(), npc_midsummer_bonfire::Ignite(), and WorldObject::SummonGameObject().

◆ addHatedBy()

void Unit::addHatedBy ( HostileReference pHostileReference)
inline

◆ AddInterruptMask()

void Unit::AddInterruptMask ( uint32  mask)
inline
1506{ m_interruptMask |= mask; }

References m_interruptMask.

Referenced by _CreateAuraApplication(), and Spell::handle_immediate().

◆ AddPetAura()

void Unit::AddPetAura ( PetAura const *  petSpell)
17215{
17216 if (GetTypeId() != TYPEID_PLAYER)
17217 return;
17218
17219 m_petAuras.insert(petSpell);
17220 if (Pet* pet = ToPlayer()->GetPet())
17221 pet->CastPetAura(petSpell);
17222 else if (Unit* charm = GetCharm())
17223 charm->CastPetAura(petSpell);
17224}
Pet * GetPet(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:218
Definition: Pet.h:41
Unit * GetCharm() const
Definition: Unit.cpp:10606
PetAuraSet m_petAuras
Definition: Unit.h:1677

References GetCharm(), Object::GetTypeId(), m_petAuras, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Spell::EffectDummy(), and AuraEffect::HandleAuraDummy().

◆ AddPlayerToVision()

void Unit::AddPlayerToVision ( Player player)
11105{
11106 if (m_sharedVision.empty())
11107 {
11108 setActive(true);
11109 SetWorldObject(true);
11110 }
11111 m_sharedVision.push_back(player);
11112 player->m_isInSharedVisionOf.insert(this);
11113}
void SetWorldObject(bool apply)
Definition: Object.cpp:1066
void setActive(bool isActiveObject)
Definition: Object.cpp:1085

References Player::m_isInSharedVisionOf, m_sharedVision, WorldObject::setActive(), and WorldObject::SetWorldObject().

◆ AddPointedBy()

void Unit::AddPointedBy ( SafeUnitPointer sup)
inline
1748{ SafeUnitPointerSet.insert(sup); }
std::set< SafeUnitPointer * > SafeUnitPointerSet
Definition: Unit.h:1747

References SafeUnitPointerSet.

Referenced by SafeUnitPointer::SetPointedTo().

◆ AddSpellCooldown()

virtual void Unit::AddSpellCooldown ( uint32  ,
uint32  ,
uint32  ,
bool  needSendToClient = false,
bool  forceSendToSpectator = false 
)
inlinevirtual

◆ AddThreat()

void Unit::AddThreat ( Unit victim,
float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  threatSpell = nullptr 
)
14581{
14582 // Only mobs can manage threat lists
14584 {
14585 m_ThreatMgr.AddThreat(victim, fThreat, schoolMask, threatSpell);
14586 }
14587}
@ UNIT_STATE_EVADE
Definition: UnitDefines.h:170
void AddThreat(Unit *victim, float threat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: ThreatMgr.cpp:436
bool CanHaveThreatList() const
Definition: Unit.cpp:14541
bool HasUnitState(const uint32 f) const
Definition: Unit.h:739

References ThreatMgr::AddThreat(), CanHaveThreatList(), HasUnitState(), m_ThreatMgr, and UNIT_STATE_EVADE.

Referenced by Attack(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), boss_shade_of_aran::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::AttackStart(), npc_capernian::AttackStart(), npc_dirt_mound::ChaseNewTarget(), boss_buru::ChaseNewVictim(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DamageTaken(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), DealDamage(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), CreatureAI::DoZoneInCombat(), Spell::EffectThreat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), npc_raging_flames::FixateRandomTarget(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), spell_morogrim_tidewalker_water_globule_new_target::HandleDummy(), HandleDummyAuraProc(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), AuraEffect::HandlePeriodicManaLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_the_lich_king_vile_spirit_move_target_search::HandleScript(), spell_pursue::HandleScript(), Spell::HandleThreatSpells(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_tiger_matriarch::npc_tiger_matriarchAI::IsSummonedBy(), npc_little_ooze::npc_little_oozeAI::IsSummonedBy(), npc_malchezaar_axe::JustEngagedWith(), npc_thaladred::JustEngagedWith(), boss_buru::JustEngagedWith(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), boss_curator::JustSummoned(), boss_sacrolash::boss_sacrolashAI::JustSummoned(), boss_devourer_of_souls::boss_devourer_of_soulsAI::JustSummoned(), npc_akama_illidan::npc_akama_illidanAI::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), boss_shade_of_akama::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_mage_mirror_image::MySelectNextTarget(), SmartScript::ProcessAction(), RemoveCharmedBy(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::Reset(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::Reset(), npc_tainted_elemental::Reset(), npc_pet_hunter_snake_trap::Reset(), boss_romulo::ScheduleCombat(), boss_supremus::SchedulePhase(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), brann_bronzebeard::brann_bronzebeardAI::SummonCreatures(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_kagani_nightstrike::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), and npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI().

◆ AddToWorld()

void Unit::AddToWorld ( )
overridevirtual

Reimplemented from WorldObject.

15616{
15617 if (!IsInWorld())
15618 {
15620 }
15621}
void AddToWorld() override
Definition: Object.cpp:1176

References WorldObject::AddToWorld(), and Object::IsInWorld().

Referenced by Creature::AddToWorld(), Pet::AddToWorld(), and Player::AddToWorld().

◆ AddUnitMovementFlag()

◆ AddUnitState()

void Unit::AddUnitState ( uint32  f)
inline
738{ m_state |= f; }

References m_state.

Referenced by _ExitVehicle(), RandomMovementGenerator< T >::_setRandomLocation(), MotionTransport::AddPassenger(), Attack(), boss_prince_keleseth_icc::boss_prince_kelesethAI::boss_prince_kelesethAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::boss_prince_taldaramAI(), boss_prince_valanar_icc::boss_prince_valanarAI::boss_prince_valanarAI(), Creature::Create(), MotionTransport::CreateNPCPassenger(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), boss_nightbane::DoAction(), WaypointMovementGenerator< Creature >::DoInitialize(), RandomMovementGenerator< T >::DoInitialize(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoReset(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_jindo::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), Creature::FocusTarget(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetCastSpellOpcode(), RotateMovementGenerator::Initialize(), DistractMovementGenerator::Initialize(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), Player::LoadFromDB(), boss_ayamiss::MovementInform(), boss_lady_vashj::MovementInform(), npc_pet_gen_moth::npc_pet_gen_moth(), npc_pet_gen_valkyr_guardian::npc_pet_gen_valkyr_guardian(), npc_pet_gen_wind_rider_cub::npc_pet_gen_wind_rider_cub(), npc_corrupted_totem::Reset(), boss_jedoga_shadowseeker::Reset(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), boss_hungarfen::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), SetCharmedBy(), SetContestedPvP(), SetControlled(), SetCurrentCastedSpell(), Player::setDeathState(), Player::SetIsSpectator(), boss_urom::boss_uromAI::SpellHit(), WaypointMovementGenerator< Creature >::StartMove(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), and boss_svala::boss_svalaAI::UpdateAI().

◆ AddUnitTypeMask()

void Unit::AddUnitTypeMask ( uint32  mask)
inline
749{ m_unitTypeMask |= mask; }

References m_unitTypeMask.

◆ ApplyAttackTimePercentMod()

void Unit::ApplyAttackTimePercentMod ( WeaponAttackType  att,
float  val,
bool  apply 
)
16983{
16984 float remainingTimePct = std::max((float)m_attackTimer[att], 0.0f) / (GetAttackTime(att) * m_modAttackSpeedPct[att]);
16985 if (val > 0)
16986 {
16988 ApplyPercentModFloatValue(static_cast<uint16>(UNIT_FIELD_BASEATTACKTIME) + att, val, !apply);
16989 }
16990 else
16991 {
16993 ApplyPercentModFloatValue(static_cast<uint16>(UNIT_FIELD_BASEATTACKTIME) + att, -val, apply);
16994 }
16995 m_attackTimer[att] = uint32(GetAttackTime(att) * m_modAttackSpeedPct[att] * remainingTimePct);
16996}
@ UNIT_FIELD_BASEATTACKTIME
Definition: UpdateFields.h:120
std::uint16_t uint16
Definition: Define.h:108
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:50
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
Definition: Object.cpp:829
uint32 GetAttackTime(WeaponAttackType att) const
Definition: Unit.h:812

References Object::ApplyPercentModFloatValue(), ApplyPercentModFloatVar(), GetAttackTime(), m_attackTimer, m_modAttackSpeedPct, and UNIT_FIELD_BASEATTACKTIME.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleAuraModRangedHaste(), AuraEffect::HandleModAttackSpeed(), AuraEffect::HandleModCombatSpeedPct(), AuraEffect::HandleModMeleeRangedSpeedPct(), AuraEffect::HandleModMeleeSpeedPct(), and AuraEffect::HandleRangedAmmoHaste().

◆ ApplyCastTimePercentMod()

void Unit::ApplyCastTimePercentMod ( float  val,
bool  apply 
)
16999{
17000 if (val > 0)
17002 else
17004}
@ UNIT_MOD_CAST_SPEED
Definition: UpdateFields.h:137

References Object::ApplyPercentModFloatValue(), and UNIT_MOD_CAST_SPEED.

Referenced by Player::ApplyRatingMod(), AuraEffect::HandleModCastingSpeed(), and AuraEffect::HandleModCombatSpeedPct().

◆ ApplyDiminishingAura()

void Unit::ApplyDiminishingAura ( DiminishingGroup  group,
bool  apply 
)
15054{
15055 // Checking for existing in the table
15056 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
15057 {
15058 if (i->DRGroup != group)
15059 continue;
15060
15061 if (apply)
15062 i->stack += 1;
15063 else if (i->stack)
15064 {
15065 i->stack -= 1;
15066 // Remember time after last aura from group removed
15067 if (i->stack == 0)
15068 i->hitTime = GameTime::GetGameTimeMS().count();
15069 }
15070 break;
15071 }
15072}
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
Diminishing m_Diminishing
Definition: Unit.h:1922

References GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by UnitAura::_ApplyForTarget(), and UnitAura::_UnapplyForTarget().

◆ ApplyDiminishingToDuration()

float Unit::ApplyDiminishingToDuration ( DiminishingGroup  group,
int32 duration,
Unit caster,
DiminishingLevels  Level,
int32  limitduration 
)
14975{
14976 // xinef: dont apply diminish to self casts
14977 if (duration == -1 || group == DIMINISHING_NONE)
14978 return 1.0f;
14979
14980 // test pet/charm masters instead pets/charmeds
14981 Unit const* targetOwner = GetOwner();
14982 Unit const* casterOwner = caster->GetOwner();
14983
14984 // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0)
14985 if (limitduration > 0 && duration > limitduration)
14986 {
14987 Unit const* target = targetOwner ? targetOwner : this;
14988 Unit const* source = casterOwner ? casterOwner : caster;
14989
14990 if ((target->IsPlayer()
14992 && source->IsPlayer())
14993 duration = limitduration;
14994 }
14995
14996 float mod = 1.0f;
14997
14998 if (group == DIMINISHING_TAUNT)
14999 {
15000 if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS))
15001 {
15002 DiminishingLevels diminish = Level;
15003 switch (diminish)
15004 {
15006 break;
15008 mod = 0.65f;
15009 break;
15011 mod = 0.4225f;
15012 break;
15014 mod = 0.274625f;
15015 break;
15017 mod = 0.0f;
15018 break;
15019 default:
15020 break;
15021 }
15022 }
15023 }
15024 // Some diminishings applies to mobs too (for example, Stun)
15026 && ((targetOwner ? (targetOwner->IsPlayer()) : (IsPlayer()))
15027 || (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
15029 {
15030 DiminishingLevels diminish = Level;
15031 switch (diminish)
15032 {
15034 break;
15036 mod = 0.5f;
15037 break;
15039 mod = 0.25f;
15040 break;
15042 mod = 0.0f;
15043 break;
15044 default:
15045 break;
15046 }
15047 }
15048
15049 duration = int32(duration * mod);
15050 return mod;
15051}
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group)
Definition: SpellMgr.cpp:246
@ CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS
Definition: CreatureData.h:65
@ CREATURE_FLAG_EXTRA_ALL_DIMINISH
Definition: CreatureData.h:66
DiminishingLevels
Definition: Unit.h:262
@ DIMINISHING_LEVEL_3
Definition: Unit.h:265
@ DIMINISHING_LEVEL_1
Definition: Unit.h:263
@ DIMINISHING_LEVEL_4
Definition: Unit.h:267
@ DIMINISHING_LEVEL_IMMUNE
Definition: Unit.h:266
@ DIMINISHING_LEVEL_TAUNT_IMMUNE
Definition: Unit.h:268
@ DIMINISHING_LEVEL_2
Definition: Unit.h:264
@ DIMINISHING_NONE
Definition: SharedDefines.h:3258
@ DIMINISHING_TAUNT
Definition: SharedDefines.h:3276
@ DRTYPE_PLAYER
Definition: SharedDefines.h:3251
@ DRTYPE_ALL
Definition: SharedDefines.h:3252
uint32 flags_extra
Definition: CreatureData.h:249

References CREATURE_FLAG_EXTRA_ALL_DIMINISH, CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS, DIMINISHING_LEVEL_1, DIMINISHING_LEVEL_2, DIMINISHING_LEVEL_3, DIMINISHING_LEVEL_4, DIMINISHING_LEVEL_IMMUNE, DIMINISHING_LEVEL_TAUNT_IMMUNE, DIMINISHING_NONE, DIMINISHING_TAUNT, DRTYPE_ALL, DRTYPE_PLAYER, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetDiminishingReturnsGroupType(), GetOwner(), Object::GetTypeId(), Object::IsPlayer(), Object::ToCreature(), and TYPEID_UNIT.

Referenced by Spell::DoSpellHitOnUnit().

◆ ApplyEffectModifiers()

float Unit::ApplyEffectModifiers ( SpellInfo const *  spellProto,
uint8  effect_index,
float  value 
) const
14757{
14758 if (Player* modOwner = GetSpellModOwner())
14759 {
14760 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_ALL_EFFECTS, value);
14761 switch (effect_index)
14762 {
14763 case 0:
14764 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT1, value);
14765 break;
14766 case 1:
14767 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT2, value);
14768 break;
14769 case 2:
14770 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_EFFECT3, value);
14771 break;
14772 }
14773 }
14774 return value;
14775}
@ SPELLMOD_EFFECT2
Definition: SpellDefines.h:89
@ SPELLMOD_ALL_EFFECTS
Definition: SpellDefines.h:85
@ SPELLMOD_EFFECT3
Definition: SpellDefines.h:100
@ SPELLMOD_EFFECT1
Definition: SpellDefines.h:80
Player * GetSpellModOwner() const
Definition: Unit.cpp:16505

References GetSpellModOwner(), SpellInfo::Id, SPELLMOD_ALL_EFFECTS, SPELLMOD_EFFECT1, SPELLMOD_EFFECT2, and SPELLMOD_EFFECT3.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellEffectInfo::CalcValue(), and Spell::EffectSchoolDMG().

◆ ApplyResilience()

void Unit::ApplyResilience ( Unit const *  victim,
float *  crit,
int32 damage,
bool  isCrit,
CombatRating  type 
)
static
18845{
18846 // player mounted on multi-passenger mount is also classified as vehicle
18847 if (victim->IsVehicle() && victim->GetTypeId() != TYPEID_PLAYER)
18848 return;
18849
18850 Unit const* target = nullptr;
18851 if (victim->IsPlayer())
18852 target = victim;
18853 else if (victim->GetTypeId() == TYPEID_UNIT)
18854 {
18855 if (Unit* owner = victim->GetOwner())
18856 if (owner->IsPlayer())
18857 target = owner;
18858 }
18859
18860 if (!target)
18861 return;
18862
18863 switch (type)
18864 {
18866 // Crit chance reduction works against nonpets
18867 if (crit)
18868 *crit -= target->GetMeleeCritChanceReduction();
18869 if (damage)
18870 {
18871 if (isCrit)
18872 *damage -= target->GetMeleeCritDamageReduction(*damage);
18873 *damage -= target->GetMeleeDamageReduction(*damage);
18874 }
18875 break;
18877 // Crit chance reduction works against nonpets
18878 if (crit)
18879 *crit -= target->GetRangedCritChanceReduction();
18880 if (damage)
18881 {
18882 if (isCrit)
18883 *damage -= target->GetRangedCritDamageReduction(*damage);
18884 *damage -= target->GetRangedDamageReduction(*damage);
18885 }
18886 break;
18888 // Crit chance reduction works against nonpets
18889 if (crit)
18890 *crit -= target->GetSpellCritChanceReduction();
18891 if (damage)
18892 {
18893 if (isCrit)
18894 *damage -= target->GetSpellCritDamageReduction(*damage);
18895 *damage -= target->GetSpellDamageReduction(*damage);
18896 }
18897 break;
18898 default:
18899 break;
18900 }
18901}
@ CR_CRIT_TAKEN_RANGED
Definition: Unit.h:232
@ CR_CRIT_TAKEN_SPELL
Definition: Unit.h:233
@ CR_CRIT_TAKEN_MELEE
Definition: Unit.h:231
float GetSpellCritChanceReduction() const
Definition: Unit.h:926
float GetRangedCritChanceReduction() const
Definition: Unit.h:925
uint32 GetSpellCritDamageReduction(uint32 damage) const
Definition: Unit.h:931
float GetMeleeCritChanceReduction() const
Definition: Unit.h:924
uint32 GetRangedDamageReduction(uint32 damage) const
Definition: Unit.h:935
uint32 GetRangedCritDamageReduction(uint32 damage) const
Definition: Unit.h:930
uint32 GetMeleeCritDamageReduction(uint32 damage) const
Definition: Unit.h:929
uint32 GetSpellDamageReduction(uint32 damage) const
Definition: Unit.h:936
uint32 GetMeleeDamageReduction(uint32 damage) const
Definition: Unit.h:934

References CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, GetMeleeCritChanceReduction(), GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetOwner(), GetRangedCritChanceReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritChanceReduction(), GetSpellCritDamageReduction(), GetSpellDamageReduction(), Object::GetTypeId(), Object::IsPlayer(), IsVehicle(), TYPEID_PLAYER, and TYPEID_UNIT.

Referenced by CalculateSpellDamageTaken(), GetUnitCriticalChance(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript(), and SpellTakenCritChance().

◆ ApplyResistanceBuffModsMod()

void Unit::ApplyResistanceBuffModsMod ( SpellSchools  school,
bool  positive,
float  val,
bool  apply 
)
inline
1370{ ApplyModSignedFloatValue(positive ? static_cast<uint16>(UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE) + school : static_cast<uint16>(UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE) + + school, val, apply); }
@ UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE
Definition: UpdateFields.h:157
@ UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE
Definition: UpdateFields.h:158
void ApplyModSignedFloatValue(uint16 index, float val, bool apply)
Definition: Object.cpp:822

References Object::ApplyModSignedFloatValue(), UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, and UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE.

Referenced by AuraEffect::HandleAuraModResistance(), and AuraEffect::HandleAuraModResistanceExclusive().

◆ ApplyResistanceBuffModsPercentMod()

void Unit::ApplyResistanceBuffModsPercentMod ( SpellSchools  school,
bool  positive,
float  val,
bool  apply 
)
inline

◆ ApplySpellDispelImmunity()

void Unit::ApplySpellDispelImmunity ( SpellInfo const *  spellProto,
DispelType  type,
bool  apply 
)
13352{
13353 ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply);
13354
13355 if (apply && spellProto->HasAttribute(SPELL_ATTR1_IMMUNITY_PURGES_EFFECT))
13356 {
13357 // Create dispel mask by dispel type
13358 uint32 dispelMask = SpellInfo::GetDispelMask(type);
13359 // Dispel all existing auras vs current dispel type
13361 for (AuraApplicationMap::iterator itr = auras.begin(); itr != auras.end();)
13362 {
13363 SpellInfo const* spell = itr->second->GetBase()->GetSpellInfo();
13364 if (spell->GetDispelMask() & dispelMask)
13365 {
13366 // Dispel aura
13367 RemoveAura(itr);
13368 }
13369 else
13370 ++itr;
13371 }
13372 }
13373}
@ SPELL_ATTR1_IMMUNITY_PURGES_EFFECT
Definition: SharedDefines.h:434
@ IMMUNITY_DISPEL
Definition: SharedDefines.h:1398
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition: Unit.cpp:13324
std::multimap< uint32, AuraApplication * > AuraApplicationMap
Definition: Unit.h:639
AuraApplicationMap & GetAppliedAuras()
Definition: Unit.h:1267
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2040

References ApplySpellImmune(), GetAppliedAuras(), SpellInfo::GetDispelMask(), SpellInfo::HasAttribute(), SpellInfo::Id, IMMUNITY_DISPEL, RemoveAura(), and SPELL_ATTR1_IMMUNITY_PURGES_EFFECT.

Referenced by AuraEffect::HandleAuraModDispelImmunity().

◆ ApplySpellImmune()

void Unit::ApplySpellImmune ( uint32  spellId,
uint32  op,
uint32  type,
bool  apply,
SpellImmuneBlockType  blockType = SPELL_BLOCK_TYPE_ALL 
)
13325{
13326 if (apply)
13327 {
13328 // xinef: immunities with spellId 0 are intended to be applied only once (script purposes mosty)
13329 if (spellId == 0 && std::find_if(m_spellImmune[op].begin(), m_spellImmune[op].end(), spellIdImmunityPredicate(type)) != m_spellImmune[op].end())
13330 return;
13331
13332 SpellImmune immune;
13333 immune.spellId = spellId;
13334 immune.type = type;
13335 immune.blockType = blockType;
13336 m_spellImmune[op].push_back(std::move(immune));
13337 }
13338 else
13339 {
13340 for (SpellImmuneList::iterator itr = m_spellImmune[op].begin(); itr != m_spellImmune[op].end(); ++itr)
13341 {
13342 if (itr->spellId == spellId && itr->type == type)
13343 {
13344 m_spellImmune[op].erase(itr);
13345 break;
13346 }
13347 }
13348 }
13349}
Definition: Unit.cpp:13315
Definition: SpellDefines.h:172
uint32 blockType
Definition: SpellDefines.h:177
uint32 spellId
Definition: SpellDefines.h:175
uint32 type
Definition: SpellDefines.h:176

References SpellImmune::blockType, m_spellImmune, SpellImmune::spellId, and SpellImmune::type.

Referenced by Vehicle::ApplyAllImmunities(), boss_kelidan_the_breaker::ApplyImmunities(), ApplyMechanicImmune(), ApplySpellDispelImmunity(), boss_amanitar::boss_amanitar(), boss_anubarak_trial::boss_anubarak_trialAI::boss_anubarak_trialAI(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_icehowl::boss_icehowlAI::boss_icehowlAI(), boss_sindragosa::boss_sindragosaAI::boss_sindragosaAI(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_void_reaver::boss_void_reaver(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDmgImmunity(), AuraEffect::HandleAuraModEffectImmunity(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleAuraModStateImmunity(), Aura::HandleAuraSpecificMods(), spell_q13007_iron_colossus::HandleDummy(), spell_love_in_air_perfume_immune::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_dk_anti_magic_shell_self::HandleEffectApply(), spell_dk_pet_scaling::HandleEffectApply(), spell_dru_treant_scaling::HandleEffectApply(), spell_pet_hit_expertise_scalling::HandleEffectApply(), spell_mage_pet_scaling::HandleEffectApply(), spell_pri_shadowfiend_scaling::HandleEffectApply(), spell_sha_feral_spirit_scaling::HandleEffectApply(), spell_sha_fire_elemental_scaling::HandleEffectApply(), spell_warl_infernal_scaling::HandleEffectApply(), spell_love_in_air_perfume_immune::HandleEffectRemove(), spell_dk_anti_magic_shell_self::HandleEffectRemove(), spell_gen_bg_preparation::HandleEffectRemove(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), npc_hyjal_jaina::hyjalJainaAI::hyjalJainaAI(), npc_pet_dk_army_of_the_dead::npc_pet_dk_army_of_the_deadAI::InitializeAI(), boss_hydross_the_unstable::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Player::LoadFromDB(), Creature::LoadSpellTemplateImmunity(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_target_dummy::npc_target_dummyAI::npc_target_dummyAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::npc_tournament_training_dummyAI(), npc_training_dummy::npc_training_dummyAI::npc_training_dummyAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::npc_ulduar_arachnopod_destroyerAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::npc_valkyr_shadowguardAI(), spell_yogg_saron_malady_of_the_mind_aura::OnApply(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnCreatureCreate(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), npc_chesspiece::Reset(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_felblood_kaelthas::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::Reset(), npc_dark_iron_guzzler::Reset(), boss_mal_ganis::boss_mal_ganisAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_gluth::boss_gluthAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_auriaya::boss_auriayaAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_supremus::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), boss_supremus::SchedulePhase(), boss_hydross_the_unstable::SetForm(), boss_felblood_kaelthas::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), Creature::UpdateEntry(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ ApplyStatBuffMod()

void Unit::ApplyStatBuffMod ( Stats  stat,
float  val,
bool  apply 
)
inline
1377{ ApplyModSignedFloatValue((val > 0 ? static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat : static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat), val, apply); }
@ UNIT_FIELD_POSSTAT0
Definition: UpdateFields.h:146
@ UNIT_FIELD_NEGSTAT0
Definition: UpdateFields.h:151

References Object::ApplyModSignedFloatValue(), UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::_ApplyItemBonuses(), Player::ApplyEnchantment(), and AuraEffect::HandleAuraModStat().

◆ ApplyStatPercentBuffMod()

void Unit::ApplyStatPercentBuffMod ( Stats  stat,
float  val,
bool  apply 
)
15265{
15266 if (val == -100.0f) // prevent set var to zero
15267 val = -99.99f;
15268 float var = GetStat(stat) * val / 100.0f;
15269 ApplyModSignedFloatValue((var > 0 ? static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat : static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat), var, apply);
15270}
float GetStat(Stats stat) const
Definition: Unit.h:772

References Object::ApplyModSignedFloatValue(), GetStat(), UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by AuraEffect::HandleModTotalPercentStat().

◆ ApplyTotalThreatModifier()

float Unit::ApplyTotalThreatModifier ( float  fThreat,
SpellSchoolMask  schoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
14569{
14570 if (!HasAuraType(SPELL_AURA_MOD_THREAT) || fThreat < 0)
14571 return fThreat;
14572
14573 SpellSchools school = GetFirstSchoolInMask(schoolMask);
14574
14575 return fThreat * m_threatModifier[school];
14576}
@ SPELL_AURA_MOD_THREAT
Definition: SpellAuraDefines.h:73
SpellSchools
Definition: SharedDefines.h:282
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
Definition: SharedDefines.h:318
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5656

References GetFirstSchoolInMask(), HasAuraType(), m_threatModifier, and SPELL_AURA_MOD_THREAT.

Referenced by ThreatCalcHelper::calcThreat().

◆ Attack()

bool Unit::Attack ( Unit victim,
bool  meleeAttack 
)
Todo:
: Implement aggro range, detection range and assistance range templates
10215{
10216 if (!victim || victim == this)
10217 return false;
10218
10219 // dead units can neither attack nor be attacked
10220 if (!IsAlive() || !victim->IsAlive())
10221 return false;
10222
10223 // pussywizard: check map, world, phase >_> multithreading crash fix
10224 if (!IsInMap(victim) || !InSamePhase(victim))
10225 return false;
10226
10227 // player cannot attack in mount state
10228 if (IsPlayer() && IsMounted())
10229 return false;
10230
10231 // creatures cannot attack while evading
10232 Creature* creature = ToCreature();
10233 if (creature && creature->IsInEvadeMode())
10234 {
10235 return false;
10236 }
10237
10238 // creatures should not try to attack the player during polymorph
10239 if (creature && creature->IsPolymorphed())
10240 {
10241 return false;
10242 }
10243
10244 //if (HasUnitFlag(UNIT_FLAG_PACIFIED)) // pussywizard: why having this flag prevents from entering combat? it should just prevent melee attack
10245 // return false;
10246
10247 // nobody can attack GM in GM-mode
10248 if (victim->IsPlayer())
10249 {
10250 if (victim->ToPlayer()->IsGameMaster())
10251 return false;
10252 }
10253 else
10254 {
10255 if (victim->ToCreature()->IsEvadingAttacks())
10256 return false;
10257 }
10258
10259 // Unit with SPELL_AURA_SPIRIT_OF_REDEMPTION can not attack
10261 return false;
10262
10263 // remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
10266
10267 if (m_attacking)
10268 {
10269 if (m_attacking == victim)
10270 {
10271 // switch to melee attack from ranged/magic
10272 if (meleeAttack)
10273 {
10275 {
10277 SendMeleeAttackStart(victim);
10278 return true;
10279 }
10280 }
10282 {
10284 SendMeleeAttackStop(victim);
10285 return true;
10286 }
10287 return false;
10288 }
10289
10290 // switch target
10291 InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
10292 if (!meleeAttack)
10294 }
10295
10296 if (m_attacking)
10298
10299 m_attacking = victim;
10301
10302 // Set our target
10303 SetTarget(victim->GetGUID());
10304
10305 if (meleeAttack)
10307
10308 // set position before any AI calls/assistance
10309 //if (GetTypeId() == TYPEID_UNIT)
10310 // ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ());
10311 if (creature && !(IsControllableGuardian() && IsControlledByPlayer()))
10312 {
10313 // should not let player enter combat by right clicking target - doesn't helps
10314 SetInCombatWith(victim);
10315 if (victim->IsPlayer())
10316 victim->SetInCombatWith(this);
10317 AddThreat(victim, 0.0f);
10318
10320
10323 {
10324 creature->CallAssistance();
10325 }
10327
10329 }
10330
10331 // delay offhand weapon attack to next attack time
10334
10335 if (meleeAttack)
10336 SendMeleeAttackStart(victim);
10337
10338 return true;
10339}
@ SPELL_AURA_SPIRIT_OF_REDEMPTION
Definition: SpellAuraDefines.h:239
@ SPELL_AURA_MOD_UNATTACKABLE
Definition: SpellAuraDefines.h:156
@ UNIT_NPC_EMOTESTATE
Definition: UpdateFields.h:140
@ CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE
Definition: CreatureData.h:71
#define ATTACK_DISPLAY_DELAY
Definition: Unit.h:624
@ CURRENT_MELEE_SPELL
Definition: Unit.h:537
@ UNIT_STATE_MELEE_ATTACKING
Definition: UnitDefines.h:150
@ CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD
Definition: IWorld.h:288
@ EMOTE_ONESHOT_NONE
Definition: SharedDefines.h:1894
@ AI_REACTION_HOSTILE
Definition: SharedDefines.h:3242
#define sWorld
Definition: World.h:444
void CallAssistance(Unit *target=nullptr)
Definition: Creature.cpp:2428
bool IsEvadingAttacks() const
Definition: Creature.h:138
void SetAssistanceTimer(uint32 value)
Definition: Creature.h:401
void SendAIReaction(AiReaction reactionType)
Definition: Creature.cpp:2416
bool IsInEvadeMode() const
Definition: Creature.h:137
bool InSamePhase(WorldObject const *obj) const
Definition: Object.h:445
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1285
bool IsGameMaster() const
Definition: Player.h:1157
void ClearUnitState(uint32 f)
Definition: Unit.h:740
bool IsPolymorphed() const
Definition: Unit.cpp:16669
void AddThreat(Unit *victim, float fThreat, SpellSchoolMask schoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell=nullptr)
Definition: Unit.cpp:14580
void _removeAttacker(Unit *pAttacker)
Definition: Unit.h:702
bool haveOffhandWeapon() const
Definition: Unit.cpp:522
void _addAttacker(Unit *pAttacker)
Definition: Unit.h:698
void SetInCombatWith(Unit *enemy, uint32 duration=0)
Definition: Unit.cpp:13516
bool IsMounted() const
Definition: Unit.h:887
void SendMeleeAttackStart(Unit *victim, Player *sendTo=nullptr)
Definition: Unit.cpp:3028
bool IsControllableGuardian() const
Definition: Unit.h:753
void SetUInt32Value(uint16 index, uint32 value)
Definition: Unit.cpp:21203
void SendMeleeAttackStop(Unit *victim=nullptr)
Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or int...
Definition: Unit.cpp:3044
bool IsControlledByPlayer() const
Definition: Unit.h:1171
virtual void SetTarget(ObjectGuid=ObjectGuid::Empty)=0

References _addAttacker(), _removeAttacker(), AddThreat(), AddUnitState(), AI_REACTION_HOSTILE, ATTACK_DISPLAY_DELAY, Creature::CallAssistance(), ClearUnitState(), CONFIG_CREATURE_FAMILY_ASSISTANCE_PERIOD, CREATURE_FLAG_EXTRA_DONT_CALL_ASSISTANCE, CURRENT_MELEE_SPELL, EMOTE_ONESHOT_NONE, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), Object::GetGUID(), HasAuraType(), HasUnitState(), haveOffhandWeapon(), WorldObject::InSamePhase(), InterruptSpell(), IsAlive(), isAttackReady(), IsControllableGuardian(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), Player::IsGameMaster(), Creature::IsInEvadeMode(), WorldObject::IsInMap(), IsMounted(), Object::IsPlayer(), IsPolymorphed(), m_attacking, OFF_ATTACK, RemoveAurasByType(), Creature::SendAIReaction(), SendMeleeAttackStart(), SendMeleeAttackStop(), Creature::SetAssistanceTimer(), setAttackTimer(), SetInCombatWith(), SetTarget(), SetUInt32Value(), SPELL_AURA_MOD_UNATTACKABLE, SPELL_AURA_SPIRIT_OF_REDEMPTION, sWorld, Object::ToCreature(), Object::ToPlayer(), UNIT_NPC_EMOTESTATE, and UNIT_STATE_MELEE_ATTACKING.

Referenced by UnitAI::AttackStart(), FollowerAI::AttackStart(), PossessedAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::AttackStart(), npc_gunship_mage::npc_gunship_mageAI::AttackStart(), npc_gunship_gunner::npc_gunship_gunnerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), boss_illidan_stormrage::boss_illidan_stormrageAI::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), TurretAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), boss_jormungarAI::AttackStart(), boss_four_horsemen::boss_four_horsemenAI::AttackStart(), boss_magus_telestra::boss_magus_telestraAI::AttackStart(), boss_kologarn::boss_kologarnAI::AttackStart(), boss_mimiron::boss_mimironAI::AttackStart(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_high_nethermancer_zerevor::AttackStart(), boss_lady_malande::AttackStart(), boss_the_lurker_below::AttackStart(), boss_olm_the_summoner::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), boss_nazan::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), npc_pet_gen_gnomish_flame_turret::AttackStart(), UnitAI::AttackStartCaster(), ScriptedAI::AttackStartNoMove(), PetAI::DoAttack(), WorldSession::HandleAttackSwingOpcode(), spell_q12096_q12092_dummy::HandleDummy(), WorldSession::HandlePetActionHelper(), boss_halazzi::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), RemoveCharmedBy(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), Player::UpdateCharmedAI(), and npc_ranger_lilatha::WaypointReached().

◆ AttackerStateUpdate()

void Unit::AttackerStateUpdate ( Unit victim,
WeaponAttackType  attType = BASE_ATTACK,
bool  extra = false,
bool  ignoreCasting = false 
)
2533{
2535 {
2536 return;
2537 }
2538
2539 if (HasUnitState(UNIT_STATE_CANNOT_AUTOATTACK) && !extra && !ignoreCasting)
2540 {
2541 return;
2542 }
2543
2544 if (!victim->IsAlive())
2545 return;
2546
2547 if ((attType == BASE_ATTACK || attType == OFF_ATTACK) && !IsWithinLOSInMap(victim))
2548 return;
2549
2550 // CombatStart puts the target into stand state, so we need to cache sit state here to know if we should crit later
2551 const bool sittingVictim = victim->IsPlayer() && (victim->IsSitState() || victim->getStandState() == UNIT_STAND_STATE_SLEEP);
2552
2553 CombatStart(victim);
2555
2556 if (attType != BASE_ATTACK && attType != OFF_ATTACK)
2557 return; // ignore ranged case
2558
2559 if (!extra && _lastExtraAttackSpell)
2560 {
2562 }
2563
2564 bool meleeAttack = true;
2565
2566 // melee attack spell casted at main hand attack only - no normal melee dmg dealt
2567 if (attType == BASE_ATTACK && m_currentSpells[CURRENT_MELEE_SPELL] && !extra)
2568 {
2569 meleeAttack = false; // The melee attack is replaced by the melee spell
2570
2572 SpellCastResult castResult = meleeSpell->CheckCast(false);
2573 if (castResult != SPELL_CAST_OK)
2574 {
2575 meleeSpell->SendCastResult(castResult);
2576 meleeSpell->SendInterrupted(0);
2577
2578 meleeSpell->finish(false);
2579 meleeSpell->SetExecutedCurrently(false);
2580
2581 if (castResult == SPELL_FAILED_NO_POWER)
2582 {
2583 // Not enough rage, do a regular melee attack instead
2584 meleeAttack = true;
2585 }
2586 }
2587 else
2588 {
2589 meleeSpell->cast(true);
2590 }
2591 }
2592 if (meleeAttack)
2593 {
2594 // attack can be redirected to another target
2595 victim = GetMeleeHitRedirectTarget(victim);
2596 CalcDamageInfo damageInfo;
2597 CalculateMeleeDamage(victim, &damageInfo, attType, sittingVictim);
2598
2599 // Send log damage message to client
2600 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2601 {
2602 Unit::DealDamageMods(victim, damageInfo.damages[i].damage, &damageInfo.damages[i].absorb);
2603 }
2604
2605 SendAttackStateUpdate(&damageInfo);
2606
2607 //TriggerAurasProcOnEvent(damageInfo);
2608
2609 _lastDamagedTargetGuid = victim->GetGUID();
2610
2611 DealMeleeDamage(&damageInfo, true);
2612
2613 DamageInfo dmgInfo(damageInfo);
2614 Unit::ProcDamageAndSpell(damageInfo.attacker, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, dmgInfo.GetDamage(),
2615 damageInfo.attackType, nullptr, nullptr, -1, nullptr, &dmgInfo);
2616
2617 if (IsPlayer())
2618 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (Player) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2619 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2620 else
2621 LOG_DEBUG("entities.unit", "AttackerStateUpdate: (NPC) {} attacked {} for {} dmg, absorbed {}, blocked {}, resisted {}.",
2622 GetGUID().ToString(), victim->GetGUID().ToString(), dmgInfo.GetDamage(), dmgInfo.GetAbsorb(), dmgInfo.GetBlock(), dmgInfo.GetResist());
2623
2624 // Let the pet know we've started attacking someting. Handles melee attacks only
2625 // Spells such as auto-shot and others handled in WorldSession::HandleCastSpellOpcode
2626 if (IsPlayer() && !m_Controlled.empty())
2627 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
2628 if (Unit* pet = *itr)
2629 if (pet->IsAlive() && pet->GetTypeId() == TYPEID_UNIT)
2630 pet->ToCreature()->AI()->OwnerAttacked(victim);
2631 }
2632}
@ AURA_INTERRUPT_FLAG_MELEE_ATTACK
Definition: SpellDefines.h:56
#define MAX_ITEM_PROTO_DAMAGES
Definition: ItemTemplate.h:613
@ UNIT_STAND_STATE_SLEEP
Definition: UnitDefines.h:35
@ UNIT_STATE_CANNOT_AUTOATTACK
Definition: UnitDefines.h:193
@ UNIT_FLAG_PACIFIED
Definition: UnitDefines.h:246
@ SPELL_FAILED_NO_POWER
Definition: SharedDefines.h:1034
bool IsWithinLOSInMap(WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
Definition: Object.cpp:1347
std::string ToString() const
Definition: ObjectGuid.cpp:47
std::string ToString() const
Definition: Position.cpp:51
Definition: Unit.h:330
Definition: Unit.h:463
uint32 procAttacker
Definition: Unit.h:480
uint32 procVictim
Definition: Unit.h:481
struct CalcDamageInfo::@261 damages[MAX_ITEM_PROTO_DAMAGES]
uint32 absorb
Definition: Unit.h:471
uint32 damage
Definition: Unit.h:470
uint32 procEx
Definition: Unit.h:482
Unit * attacker
Definition: Unit.h:464
Unit * target
Definition: Unit.h:465
WeaponAttackType attackType
Definition: Unit.h:479
void SendAttackStateUpdate(CalcDamageInfo *damageInfo)
Definition: Unit.cpp:6430
void CombatStart(Unit *target, bool initialAggro=true)
Definition: Unit.cpp:13560
Unit * GetMeleeHitRedirectTarget(Unit *victim, SpellInfo const *spellInfo=nullptr)
Definition: Unit.cpp:10992
void CalculateMeleeDamage(Unit *victim, CalcDamageInfo *damageInfo, WeaponAttackType attackType=BASE_ATTACK, const bool sittingVictim=false)
Definition: Unit.cpp:1451
static void ProcDamageAndSpell(Unit *actor, Unit *victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType=BASE_ATTACK, SpellInfo const *procSpellInfo=nullptr, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition: Unit.cpp:6329
uint8 getStandState() const
Definition: Unit.h:879
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
Definition: Unit.cpp:1816
static void DealDamageMods(Unit const *victim, uint32 &damage, uint32 *absorb)
Definition: Unit.cpp:787
void cast(bool skipCheck=false)
Definition: Spell.cpp:3781
void SetExecutedCurrently(bool yes)
Definition: Spell.h:561
void SendInterrupted(uint8 result)
Definition: Spell.cpp:5164
static void SendCastResult(Player *caster, SpellInfo const *spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE)
Definition: Spell.cpp:4659
void finish(bool ok=true)
Definition: Spell.cpp:4472

References _lastDamagedTargetGuid, _lastExtraAttackSpell, CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::attackType, AURA_INTERRUPT_FLAG_MELEE_ATTACK, BASE_ATTACK, CalculateMeleeDamage(), Spell::cast(), Spell::CheckCast(), CombatStart(), CURRENT_MELEE_SPELL, CalcDamageInfo::damage, CalcDamageInfo::damages, DealDamageMods(), DealMeleeDamage(), Spell::finish(), DamageInfo::GetAbsorb(), DamageInfo::GetBlock(), DamageInfo::GetDamage(), Object::GetGUID(), GetMeleeHitRedirectTarget(), DamageInfo::GetResist(), getStandState(), HasUnitFlag(), HasUnitState(), IsAlive(), Object::IsPlayer(), IsSitState(), WorldObject::IsWithinLOSInMap(), LOG_DEBUG, m_Controlled, m_currentSpells, MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, CalcDamageInfo::procAttacker, ProcDamageAndSpell(), CalcDamageInfo::procEx, CalcDamageInfo::procVictim, RemoveAurasWithInterruptFlags(), SendAttackStateUpdate(), Spell::SendCastResult(), Spell::SendInterrupted(), Spell::SetExecutedCurrently(), SPELL_CAST_OK, SPELL_FAILED_NO_POWER, CalcDamageInfo::target, ObjectGuid::ToString(), Position::ToString(), TYPEID_UNIT, UNIT_FLAG_PACIFIED, UNIT_STAND_STATE_SLEEP, and UNIT_STATE_CANNOT_AUTOATTACK.

Referenced by UnitAI::DoMeleeAttackIfReady(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), HandleProcExtraAttackFor(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Player::Update(), boss_dred::boss_dredAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), and boss_the_lurker_below::UpdateAI().

◆ AttackStop()

bool Unit::AttackStop ( )

Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell, AI assistance, and call SendMeleeAttackStop() to the client.

10346{
10347 if (!m_attacking)
10348 return false;
10349
10350 Unit* victim = m_attacking;
10351
10353 m_attacking = nullptr;
10354
10355 // Clear our target
10357
10359
10361
10362 // reset only at real combat stop
10363 if (Creature* creature = ToCreature())
10364 {
10365 creature->SetNoCallAssistance(false);
10366
10367 if (creature->HasSearchedAssistance())
10368 {
10369 creature->SetNoSearchAssistance(false);
10370 }
10371 }
10372
10373 SendMeleeAttackStop(victim);
10374
10375 return true;
10376}

References _removeAttacker(), ClearUnitState(), CURRENT_MELEE_SPELL, ObjectGuid::Empty, InterruptSpell(), m_attacking, SendMeleeAttackStop(), SetTarget(), Object::ToCreature(), and UNIT_STATE_MELEE_ATTACKING.

Referenced by PetAI::_stopAttack(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CombatStop(), boss_jedoga_shadowseeker::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_thekal::DamageTaken(), boss_viscidus::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), ScriptedAI::DoStopAttack(), Player::DuelComplete(), Spell::EffectSanctuary(), SmartAI::EnterEvadeMode(), Spell::finish(), WorldSession::HandleAttackStopOpcode(), spell_hun_scatter_shot::HandleDummy(), spell_mc_play_dead_aura::HandleEffectApply(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetStopAttack(), RotateMovementGenerator::Initialize(), PetAI::KilledUnit(), MotionMaster::MoveSeekAssistance(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), PetSpellFail(), RemoveCharmedBy(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_heigan::boss_heiganAI::StartFightPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), StopAttackFaction(), StopAttackingInvalidTarget(), boss_ouro::Submerge(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ BuildAuraStateUpdateForTarget()

uint32 Unit::BuildAuraStateUpdateForTarget ( Unit target) const
10477{
10479 for (AuraStateAurasMap::const_iterator itr = m_auraStateAuras.begin(); itr != m_auraStateAuras.end(); ++itr)
10480 if ((1 << (itr->first - 1)) & PER_CASTER_AURA_STATE_MASK)
10481 if (itr->second->GetBase()->GetCasterGUID() == target->GetGUID())
10482 auraStates |= (1 << (itr->first - 1));
10483
10484 return auraStates;
10485}
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305

References Object::GetGUID(), Object::GetUInt32Value(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, and UNIT_FIELD_AURASTATE.

Referenced by PatchValuesUpdate().

◆ BuildCooldownPacket() [1/2]

void Unit::BuildCooldownPacket ( WorldPacket data,
uint8  flags,
PacketCooldowns const &  cooldowns 
)
20898{
20899 data.Initialize(SMSG_SPELL_COOLDOWN, 8 + 1 + (4 + 4) * cooldowns.size());
20900 data << GetGUID();
20901 data << uint8(flags);
20902 for (std::unordered_map<uint32, uint32>::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
20903 {
20904 data << uint32(itr->first);
20905 data << uint32(itr->second);
20906 }
20907}
@ SMSG_SPELL_COOLDOWN
Definition: Opcodes.h:338
void Initialize(uint16 opcode, std::size_t newres=200)
Definition: WorldPacket.h:69

References Object::GetGUID(), WorldPacket::Initialize(), and SMSG_SPELL_COOLDOWN.

◆ BuildCooldownPacket() [2/2]

void Unit::BuildCooldownPacket ( WorldPacket data,
uint8  flags,
uint32  spellId,
uint32  cooldown 
)

◆ BuildHeartBeatMsg()

void Unit::BuildHeartBeatMsg ( WorldPacket data) const
2074{
2075 data->Initialize(MSG_MOVE_HEARTBEAT, 32);
2076 *data << GetPackGUID();
2077 BuildMovementPacket(data);
2078}
@ MSG_MOVE_HEARTBEAT
Definition: Opcodes.h:268
void BuildMovementPacket(ByteBuffer *data) const
Definition: Unit.cpp:19819

References BuildMovementPacket(), Object::GetPackGUID(), WorldPacket::Initialize(), and MSG_MOVE_HEARTBEAT.

Referenced by boss_volkhan::boss_volkhanAI::MovementInform(), and SendMovementFlagUpdate().

◆ BuildMovementPacket()

void Unit::BuildMovementPacket ( ByteBuffer data) const
19820{
19821 *data << uint32(GetUnitMovementFlags()); // movement flags
19822 *data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
19823 *data << uint32(GameTime::GetGameTimeMS().count()); // time / counter
19824 *data << GetPositionX();
19825 *data << GetPositionY();
19826 *data << GetPositionZ();
19827 *data << GetOrientation();
19828
19829 // 0x00000200
19831 {
19832 if (m_vehicle)
19833 *data << m_vehicle->GetBase()->GetPackGUID();
19834 else if (GetTransport())
19835 *data << GetTransport()->GetPackGUID();
19836 else
19837 *data << (uint8)0;
19838
19839 *data << float (GetTransOffsetX());
19840 *data << float (GetTransOffsetY());
19841 *data << float (GetTransOffsetZ());
19842 *data << float (GetTransOffsetO());
19843 *data << uint32(GetTransTime());
19844 *data << uint8 (GetTransSeat());
19845
19848 }
19849
19850 // 0x02200000
19853 *data << (float)m_movementInfo.pitch;
19854
19855 *data << (uint32)m_movementInfo.fallTime;
19856
19857 // 0x00001000
19859 {
19860 *data << (float)m_movementInfo.jump.zspeed;
19861 *data << (float)m_movementInfo.jump.sinAngle;
19862 *data << (float)m_movementInfo.jump.cosAngle;
19863 *data << (float)m_movementInfo.jump.xyspeed;
19864 }
19865
19866 // 0x04000000
19868 *data << (float)m_movementInfo.splineElevation;
19869}
@ MOVEMENTFLAG_ONTRANSPORT
Definition: UnitDefines.h:353
@ MOVEMENTFLAG_FLYING
Definition: UnitDefines.h:369
@ MOVEMENTFLAG_FALLING
Definition: UnitDefines.h:356
@ MOVEMENTFLAG_SWIMMING
Definition: UnitDefines.h:365
@ MOVEMENTFLAG_SPLINE_ELEVATION
Definition: UnitDefines.h:370
@ MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING
Definition: UnitDefines.h:405
@ MOVEMENTFLAG2_INTERPOLATED_MOVEMENT
Definition: UnitDefines.h:410
struct MovementInfo::JumpInfo jump
uint32 fallTime
Definition: Object.h:305
struct MovementInfo::TransportInfo transport
float splineElevation
Definition: Object.h:319
float pitch
Definition: Object.h:302
uint32 time2
Definition: Object.h:298
float cosAngle
Definition: Object.h:315
float xyspeed
Definition: Object.h:315
float zspeed
Definition: Object.h:315
float sinAngle
Definition: Object.h:315
float GetTransOffsetX() const
Definition: Object.h:598
float GetTransOffsetY() const
Definition: Object.h:599
float GetTransOffsetZ() const
Definition: Object.h:600
uint32 GetTransTime() const
Definition: Object.h:602
Transport * GetTransport() const
Definition: Object.h:597
float GetTransOffsetO() const
Definition: Object.h:601
uint32 GetUnitMovementFlags() const
Definition: Unit.h:1618
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:1624

References MovementInfo::JumpInfo::cosAngle, MovementInfo::fallTime, MovementInfo::flags2, Vehicle::GetBase(), GetExtraUnitMovementFlags(), GameTime::GetGameTimeMS(), Position::GetOrientation(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransOffsetO(), WorldObject::GetTransOffsetX(), WorldObject::GetTransOffsetY(), WorldObject::GetTransOffsetZ(), WorldObject::GetTransport(), WorldObject::GetTransSeat(), WorldObject::GetTransTime(), GetUnitMovementFlags(), MovementInfo::jump, WorldObject::m_movementInfo, m_vehicle, MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING, MOVEMENTFLAG2_INTERPOLATED_MOVEMENT, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_FLYING, MOVEMENTFLAG_ONTRANSPORT, MOVEMENTFLAG_SPLINE_ELEVATION, MOVEMENTFLAG_SWIMMING, MovementInfo::pitch, MovementInfo::JumpInfo::sinAngle, MovementInfo::splineElevation, MovementInfo::TransportInfo::time2, MovementInfo::transport, MovementInfo::JumpInfo::xyspeed, and MovementInfo::JumpInfo::zspeed.

Referenced by BuildHeartBeatMsg(), Object::BuildMovementUpdate(), WorldSession::HandleMoveKnockBackAck(), Player::SendTeleportAckPacket(), SendTeleportPacket(), Player::SetCanFly(), Creature::SetCanFly(), Creature::SetDisableGravity(), Player::SetDisableGravity(), Player::SetFeatherFall(), Creature::SetFeatherFall(), Player::SetHover(), SetSpeed(), Player::SetWaterWalking(), and Creature::SetWaterWalking().

◆ BuildValuesUpdate()

void Unit::BuildValuesUpdate ( uint8  updateType,
ByteBuffer data,
Player target 
)
overrideprotectedvirtual

Reimplemented from Object.

20614{
20615 if (!target)
20616 return;
20617
20619 uint32 visibleFlag = UF_FLAG_PUBLIC;
20620
20621 if (target == this)
20622 visibleFlag |= UF_FLAG_PRIVATE;
20623
20625 if (GetOwnerGUID() == target->GetGUID())
20626 visibleFlag |= UF_FLAG_OWNER;
20627
20630 visibleFlag |= UF_FLAG_SPECIAL_INFO;
20631
20632 if (plr && plr->IsInSameRaidWith(target))
20633 visibleFlag |= UF_FLAG_PARTY_MEMBER;
20634
20635 uint64 cacheKey = static_cast<uint64>(visibleFlag) << 8 | updateType;
20636
20637 auto cacheIt = _valuesUpdateCache.find(cacheKey);
20638 if (cacheIt != _valuesUpdateCache.end())
20639 {
20640 int32 cachePos = static_cast<int32>(data->wpos());
20641 data->append(cacheIt->second.buffer);
20642
20643 BuildValuesCachePosPointers dataAdjustedPos = cacheIt->second.posPointers;
20644 if (cachePos)
20645 dataAdjustedPos.ApplyOffset(cachePos);
20646
20647 PatchValuesUpdate(*data, dataAdjustedPos, target);
20648
20649 return;
20650 }
20651
20652 BuildValuesCachedBuffer cacheValue(500);
20653
20654 ByteBuffer fieldBuffer(400);
20655
20656 UpdateMask updateMask;
20657 updateMask.SetCount(m_valuesCount);
20658
20659 for (uint16 index = 0; index < m_valuesCount; ++index)
20660 {
20661 if (_fieldNotifyFlags & flags[index] ||
20662 ((flags[index] & visibleFlag) & UF_FLAG_SPECIAL_INFO) ||
20663 ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)) ||
20665 {
20666 updateMask.SetBit(index);
20667
20668 if (index == UNIT_NPC_FLAGS)
20669 {
20670 cacheValue.posPointers.UnitNPCFlagsPos = int32(fieldBuffer.wpos());
20671 fieldBuffer << m_uint32Values[UNIT_NPC_FLAGS];
20672 }
20673 else if (index == UNIT_FIELD_AURASTATE)
20674 {
20675 cacheValue.posPointers.UnitFieldAuraStatePos = int32(fieldBuffer.wpos());
20676 fieldBuffer << uint32(0); // Fill in later.
20677 }
20678 // FIXME: Some values at server stored in float format but must be sent to client in uint32 format
20679 else if (index >= UNIT_FIELD_BASEATTACKTIME && index <= UNIT_FIELD_RANGEDATTACKTIME)
20680 {
20681 // convert from float to uint32 and send
20682 fieldBuffer << uint32(m_floatValues[index] < 0 ? 0 : m_floatValues[index]);
20683 }
20684 // there are some float values which may be negative or can't get negative due to other checks
20685 else if ((index >= UNIT_FIELD_NEGSTAT0 && index <= UNIT_FIELD_NEGSTAT4) ||
20688 (index >= UNIT_FIELD_POSSTAT0 && index <= UNIT_FIELD_POSSTAT4))
20689 {
20690 fieldBuffer << uint32(m_floatValues[index]);
20691 }
20692 // Gamemasters should be always able to select units - remove not selectable flag
20693 else if (index == UNIT_FIELD_FLAGS)
20694 {
20695 cacheValue.posPointers.UnitFieldFlagsPos = int32(fieldBuffer.wpos());
20696 fieldBuffer << m_uint32Values[UNIT_FIELD_FLAGS];
20697 }
20698 // use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures
20699 else if (index == UNIT_FIELD_DISPLAYID)
20700 {
20701 cacheValue.posPointers.UnitFieldDisplayPos = int32(fieldBuffer.wpos());
20702 fieldBuffer << m_uint32Values[UNIT_FIELD_DISPLAYID];
20703 }
20704 else if (index == UNIT_DYNAMIC_FLAGS)
20705 {
20706 cacheValue.posPointers.UnitDynamicFlagsPos = int32(fieldBuffer.wpos());
20708 fieldBuffer << dynamicFlags;
20709 }
20710 else if (index == UNIT_FIELD_BYTES_2)
20711 {
20712 cacheValue.posPointers.UnitFieldBytes2Pos = int32(fieldBuffer.wpos());
20713 fieldBuffer << m_uint32Values[index];
20714 }
20715 else if (index == UNIT_FIELD_FACTIONTEMPLATE)
20716 {
20717 cacheValue.posPointers.UnitFieldFactionTemplatePos = int32(fieldBuffer.wpos());
20718 fieldBuffer << m_uint32Values[index];
20719 }
20720 else
20721 {
20722 if (sScriptMgr->ShouldTrackValuesUpdatePosByIndex(this, updateType, index))
20723 cacheValue.posPointers.other[index] = static_cast<uint32>(fieldBuffer.wpos());
20724
20725 // send in current format (float as float, uint32 as uint32)
20726 fieldBuffer << m_uint32Values[index];
20727 }
20728 }
20729 }
20730
20731 cacheValue.buffer << uint8(updateMask.GetBlockCount());
20732 updateMask.AppendToPacket(&cacheValue.buffer);
20733 int32 fieldBufferPos = static_cast<int32>(cacheValue.buffer.wpos());
20734 cacheValue.buffer.append(fieldBuffer);
20735 cacheValue.posPointers.ApplyOffset(fieldBufferPos);
20736
20737 int32 cachePos = static_cast<int32>(data->wpos());
20738 data->append(cacheValue.buffer);
20739
20740 BuildValuesCachePosPointers dataAdjustedPos = cacheValue.posPointers;
20741 if (cachePos)
20742 dataAdjustedPos.ApplyOffset(cachePos);
20743
20744 PatchValuesUpdate(*data, dataAdjustedPos, target);
20745
20746 _valuesUpdateCache.insert(std::pair<uint64, BuildValuesCachedBuffer>(cacheKey, std::move(cacheValue)));
20747}
@ SPELL_AURA_EMPATHY
Definition: SpellAuraDefines.h:184
@ UPDATETYPE_VALUES
Definition: UpdateData.h:28
uint32 UnitUpdateFieldFlags[PLAYER_END]
Definition: UpdateFieldFlags.cpp:162
@ UNIT_NPC_FLAGS
Definition: UpdateFields.h:139
@ UNIT_FIELD_RANGEDATTACKTIME
Definition: UpdateFields.h:121
@ UNIT_FIELD_DISPLAYID
Definition: UpdateFields.h:124
@ UNIT_FIELD_FACTIONTEMPLATE
Definition: UpdateFields.h:115
@ UNIT_FIELD_POSSTAT4
Definition: UpdateFields.h:150
@ UNIT_FIELD_NEGSTAT4
Definition: UpdateFields.h:155
@ UNIT_FIELD_FLAGS
Definition: UpdateFields.h:117
@ UNIT_DYNAMIC_FLAGS
Definition: UpdateFields.h:136
@ UF_FLAG_SPECIAL_INFO
Definition: UpdateFieldFlags.h:32
@ UF_FLAG_PUBLIC
Definition: UpdateFieldFlags.h:27
@ UF_FLAG_OWNER
Definition: UpdateFieldFlags.h:29
@ UF_FLAG_PRIVATE
Definition: UpdateFieldFlags.h:28
@ UF_FLAG_PARTY_MEMBER
Definition: UpdateFieldFlags.h:33
@ UNIT_DYNFLAG_SPECIALINFO
Definition: SharedDefines.h:3125
@ UNIT_DYNFLAG_TAPPED_BY_PLAYER
Definition: SharedDefines.h:3124
@ UNIT_DYNFLAG_TAPPED
Definition: SharedDefines.h:3123
std::uint64_t uint64
Definition: Define.h:106
uint16 _fieldNotifyFlags
Definition: Object.h:254
bool HasDynamicFlag(uint32 flag) const
Definition: Object.h:119
UpdateMask _changesMask
Definition: Object.h:250
uint32 * m_uint32Values
Definition: Object.h:246
uint16 m_valuesCount
Definition: Object.h:252
float * m_floatValues
Definition: Object.h:247
Definition: UpdateMask.h:25
uint32 GetBlockCount() const
Definition: UpdateMask.h:62
bool GetBit(uint32 index) const
Definition: UpdateMask.h:47
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:65
void SetBit(uint32 index)
Definition: UpdateMask.h:45
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:49
bool IsInSameRaidWith(Player const *p) const
Definition: Player.h:1862
ValuesUpdateCache _valuesUpdateCache
Definition: Unit.h:1947
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:10556
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition: Unit.cpp:5661
ObjectGuid GetOwnerGUID() const
Definition: Unit.h:1157
void PatchValuesUpdate(ByteBuffer &valuesUpdateBuf, BuildValuesCachePosPointers &posPointers, Player *target)
Definition: Unit.cpp:20749
Definition: UnitUtils.h:65
void ApplyOffset(uint32 offset)
Definition: UnitUtils.h:70
Definition: UnitUtils.h:110
Definition: ByteBuffer.h:70
void append(T value)
Definition: ByteBuffer.h:129
std::size_t wpos() const
Definition: ByteBuffer.h:330

References Object::_changesMask, Object::_fieldNotifyFlags, _valuesUpdateCache, ByteBuffer::append(), UpdateMask::AppendToPacket(), BuildValuesCachePosPointers::ApplyOffset(), BuildValuesCachedBuffer::buffer, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), GetCharmerOrOwnerPlayerOrPlayerItself(), Object::GetGUID(), GetOwnerGUID(), HasAuraTypeWithCaster(), Object::HasDynamicFlag(), Object::HasFlag(), Player::IsInSameRaidWith(), Object::m_floatValues, Object::m_uint32Values, Object::m_valuesCount, BuildValuesCachePosPointers::other, PatchValuesUpdate(), PER_CASTER_AURA_STATE_MASK, BuildValuesCachedBuffer::posPointers, UpdateMask::SetBit(), UpdateMask::SetCount(), SPELL_AURA_EMPATHY, sScriptMgr, UF_FLAG_OWNER, UF_FLAG_PARTY_MEMBER, UF_FLAG_PRIVATE, UF_FLAG_PUBLIC, UF_FLAG_SPECIAL_INFO, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_FIELD_AURASTATE, UNIT_FIELD_BASEATTACKTIME, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FACTIONTEMPLATE, UNIT_FIELD_FLAGS, UNIT_FIELD_NEGSTAT0, UNIT_FIELD_NEGSTAT4, UNIT_FIELD_POSSTAT0, UNIT_FIELD_POSSTAT4, UNIT_FIELD_RANGEDATTACKTIME, UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE, UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, BuildValuesCachePosPointers::UnitNPCFlagsPos, UnitUpdateFieldFlags, UPDATETYPE_VALUES, and ByteBuffer::wpos().

◆ CalcAbsorbResist()

void Unit::CalcAbsorbResist ( DamageInfo dmgInfo,
bool  Splited = false 
)
static
2115{
2116 Unit* victim = dmgInfo.GetVictim();
2117 Unit* attacker = dmgInfo.GetAttacker();
2118 uint32 damage = dmgInfo.GetDamage();
2119 SpellSchoolMask schoolMask = dmgInfo.GetSchoolMask();
2120 SpellInfo const* spellInfo = dmgInfo.GetSpellInfo();
2121
2122 if (!victim || !victim->IsAlive() || !damage)
2123 return;
2124
2125 // Magic damage, check for resists
2126 // Ignore spells that cant be resisted
2127 // Xinef: holy resistance exists for npcs
2128 if (!(schoolMask & SPELL_SCHOOL_MASK_NORMAL) && (!(schoolMask & SPELL_SCHOOL_MASK_HOLY) || victim->GetTypeId() == TYPEID_UNIT) && (!spellInfo || (!spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))))
2129 {
2130 float averageResist = Unit::GetEffectiveResistChance(attacker, schoolMask, victim);
2131
2132 float discreteResistProbability[11];
2133 for (uint32 i = 0; i < 11; ++i)
2134 {
2135 discreteResistProbability[i] = 0.5f - 2.5f * std::fabs(0.1f * i - averageResist);
2136 if (discreteResistProbability[i] < 0.0f)
2137 discreteResistProbability[i] = 0.0f;
2138 }
2139
2140 if (averageResist <= 0.1f)
2141 {
2142 discreteResistProbability[0] = 1.0f - 7.5f * averageResist;
2143 discreteResistProbability[1] = 5.0f * averageResist;
2144 discreteResistProbability[2] = 2.5f * averageResist;
2145 }
2146
2147 float r = float(rand_norm());
2148 uint32 i = 0;
2149 float probabilitySum = discreteResistProbability[0];
2150
2151 while (r >= probabilitySum && i < 10)
2152 probabilitySum += discreteResistProbability[++i];
2153
2154 float damageResisted = float(damage * i / 10);
2155
2156 if (damageResisted) // if equal to 0, checking these is pointless
2157 {
2158 if (attacker)
2159 {
2161 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2162 if (((*j)->GetMiscValue() & schoolMask) && (*j)->IsAffectedOnSpell(spellInfo))
2163 AddPct(damageResisted, -(*j)->GetAmount());
2164
2166 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2167 if ((*j)->GetMiscValue() & schoolMask)
2168 AddPct(damageResisted, -(*j)->GetAmount());
2169 }
2170
2171 // pussywizard:
2172 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC))
2173 {
2174 uint32 damageAfterArmor = Unit::CalcArmorReducedDamage(attacker, victim, damage, spellInfo, 0, BASE_ATTACK);
2175 uint32 armorReduction = damage - damageAfterArmor;
2176 if (armorReduction < damageResisted) // pick the lower one, the weakest resistance counts
2177 damageResisted = armorReduction;
2178 }
2179 }
2180
2181 dmgInfo.ResistDamage(uint32(damageResisted));
2182 }
2183
2184 // Ignore Absorption Auras
2185 float auraAbsorbMod = 0;
2186 if (attacker)
2187 {
2189 for (AuraEffectList::const_iterator itr = AbsIgnoreAurasA.begin(); itr != AbsIgnoreAurasA.end(); ++itr)
2190 {
2191 if (!((*itr)->GetMiscValue() & schoolMask))
2192 continue;
2193
2194 if ((*itr)->GetAmount() > auraAbsorbMod)
2195 auraAbsorbMod = float((*itr)->GetAmount());
2196 }
2197
2199 for (AuraEffectList::const_iterator itr = AbsIgnoreAurasB.begin(); itr != AbsIgnoreAurasB.end(); ++itr)
2200 {
2201 if (!((*itr)->GetMiscValue() & schoolMask))
2202 continue;
2203
2204 if (((*itr)->GetAmount() > auraAbsorbMod) && (*itr)->IsAffectedOnSpell(spellInfo))
2205 auraAbsorbMod = float((*itr)->GetAmount());
2206 }
2207 RoundToInterval(auraAbsorbMod, 0.0f, 100.0f);
2208 }
2209
2210 // We're going to call functions which can modify content of the list during iteration over it's elements
2211 // Let's copy the list so we can prevent iterator invalidation
2213 vSchoolAbsorbCopy.sort(Acore::AbsorbAuraOrderPred());
2214
2215 // absorb without mana cost
2216 for (AuraEffectList::iterator itr = vSchoolAbsorbCopy.begin(); (itr != vSchoolAbsorbCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2217 {
2218 AuraEffect* absorbAurEff = *itr;
2219 // Check if aura was removed during iteration - we don't need to work on such auras
2220 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2221 if (!aurApp)
2222 continue;
2223 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2224 continue;
2225
2226 // get amount which can be still absorbed by the aura
2227 int32 currentAbsorb = absorbAurEff->GetAmount();
2228 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2229 if (currentAbsorb < 0)
2230 currentAbsorb = 0;
2231
2232 uint32 tempAbsorb = uint32(currentAbsorb);
2233
2234 bool defaultPrevented = false;
2235
2236 absorbAurEff->GetBase()->CallScriptEffectAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2237 currentAbsorb = tempAbsorb;
2238
2239 if (defaultPrevented)
2240 continue;
2241
2242 // absorb must be smaller than the damage itself
2243 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2244
2245 // xinef: do this after absorb is rounded to damage...
2246 AddPct(currentAbsorb, -auraAbsorbMod);
2247
2248 dmgInfo.AbsorbDamage(currentAbsorb);
2249
2250 tempAbsorb = currentAbsorb;
2251 absorbAurEff->GetBase()->CallScriptEffectAfterAbsorbHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2252
2253 // Check if our aura is using amount to count damage
2254 if (absorbAurEff->GetAmount() >= 0)
2255 {
2256 // Reduce shield amount
2257 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2258 // Aura cannot absorb anything more - remove it
2259 if (absorbAurEff->GetAmount() <= 0)
2260 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2261 }
2262 }
2263
2264 // absorb by mana cost
2266 for (AuraEffectList::const_iterator itr = vManaShieldCopy.begin(); (itr != vManaShieldCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2267 {
2268 AuraEffect* absorbAurEff = *itr;
2269 // Check if aura was removed during iteration - we don't need to work on such auras
2270 AuraApplication const* aurApp = absorbAurEff->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2271 if (!aurApp)
2272 continue;
2273 // check damage school mask
2274 if (!(absorbAurEff->GetMiscValue() & schoolMask))
2275 continue;
2276
2277 // get amount which can be still absorbed by the aura
2278 int32 currentAbsorb = absorbAurEff->GetAmount();
2279 // aura with infinite absorb amount - let the scripts handle absorbtion amount, set here to 0 for safety
2280 if (currentAbsorb < 0)
2281 currentAbsorb = 0;
2282
2283 uint32 tempAbsorb = currentAbsorb;
2284
2285 bool defaultPrevented = false;
2286
2287 absorbAurEff->GetBase()->CallScriptEffectManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb, defaultPrevented);
2288 currentAbsorb = tempAbsorb;
2289
2290 if (defaultPrevented)
2291 continue;
2292
2293 // absorb must be smaller than the damage itself
2294 currentAbsorb = RoundToInterval(currentAbsorb, 0, int32(dmgInfo.GetDamage()));
2295
2296 // xinef: do this after absorb is rounded to damage...
2297 AddPct(currentAbsorb, -auraAbsorbMod);
2298
2299 int32 manaReduction = currentAbsorb;
2300
2301 // lower absorb amount by talents
2302 if (float manaMultiplier = absorbAurEff->GetSpellInfo()->Effects[absorbAurEff->GetEffIndex()].CalcValueMultiplier(absorbAurEff->GetCaster()))
2303 manaReduction = int32(float(manaReduction) * manaMultiplier);
2304
2305 int32 manaTaken = -victim->ModifyPower(POWER_MANA, -manaReduction);
2306
2307 // take case when mana has ended up into account
2308 currentAbsorb = currentAbsorb ? int32(float(currentAbsorb) * (float(manaTaken) / float(manaReduction))) : 0;
2309
2310 dmgInfo.AbsorbDamage(currentAbsorb);
2311
2312 tempAbsorb = currentAbsorb;
2313 absorbAurEff->GetBase()->CallScriptEffectAfterManaShieldHandlers(absorbAurEff, aurApp, dmgInfo, tempAbsorb);
2314
2315 // Check if our aura is using amount to count damage
2316 if (absorbAurEff->GetAmount() >= 0)
2317 {
2318 absorbAurEff->SetAmount(absorbAurEff->GetAmount() - currentAbsorb);
2319 if ((absorbAurEff->GetAmount() <= 0))
2320 absorbAurEff->GetBase()->Remove(AURA_REMOVE_BY_ENEMY_SPELL);
2321 }
2322 }
2323
2324 // split damage auras - only when not damaging self
2325 // Xinef: not true - Warlock Hellfire
2326 if (/*victim != attacker &&*/ !Splited)
2327 {
2328 // We're going to call functions which can modify content of the list during iteration over it's elements
2329 // Let's copy the list so we can prevent iterator invalidation
2330 AuraEffectList vSplitDamageFlatCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_FLAT)); // Not used by any spell
2331 for (AuraEffectList::iterator itr = vSplitDamageFlatCopy.begin(); (itr != vSplitDamageFlatCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2332 {
2333 // Check if aura was removed during iteration - we don't need to work on such auras
2334 if (!((*itr)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
2335 continue;
2336 // check damage school mask
2337 if (!((*itr)->GetMiscValue() & schoolMask))
2338 continue;
2339
2340 // Damage can be splitted only if aura has an alive caster
2341 Unit* caster = (*itr)->GetCaster();
2342 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2343 continue;
2344
2345 // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
2346 // Ignore LOS attribute is only used for the cast portion of the spell
2347 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2348 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
2349 if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2350 continue;
2351
2352 int32 splitDamage = (*itr)->GetAmount();
2353
2354 // absorb must be smaller than the damage itself
2355 splitDamage = RoundToInterval(splitDamage, 0, int32(dmgInfo.GetDamage()));
2356
2357 dmgInfo.AbsorbDamage(splitDamage);
2358
2359 uint32 splitted = splitDamage;
2360 uint32 splitted_absorb = 0;
2361 uint32 splitted_resist = 0;
2362
2363 uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT;
2364 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, schoolMask, dmgInfo.GetDamageType());
2365 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2366 {
2367 procEx |= PROC_EX_IMMUNE;
2368 splittedDmgInfo.AbsorbDamage(splitted);
2369 }
2370 else
2371 {
2372 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2373 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2374 }
2375
2376 splitted_absorb = splittedDmgInfo.GetAbsorb();
2377 splitted_resist = splittedDmgInfo.GetResist();
2378 splitted = splittedDmgInfo.GetDamage();
2379
2380 // create procs
2381 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2382 caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted, nullptr, -1, nullptr, &splittedDmgInfo);
2383
2384 if (attacker)
2385 {
2386 attacker->SendSpellNonMeleeDamageLog(caster, (*itr)->GetSpellInfo(), splitted, schoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2387 }
2388
2389 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2390 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*itr)->GetSpellInfo(), false);
2391 }
2392
2393 // We're going to call functions which can modify content of the list during iteration over it's elements
2394 // Let's copy the list so we can prevent iterator invalidation
2396 for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(), next; (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr)
2397 {
2398 // Check if aura was removed during iteration - we don't need to work on such auras
2399 AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID());
2400 if (!aurApp)
2401 continue;
2402
2403 // check damage school mask
2404 if (!((*itr)->GetMiscValue() & schoolMask))
2405 continue;
2406
2407 // Damage can be splitted only if aura has an alive caster
2408 Unit* caster = (*itr)->GetCaster();
2409 if (!caster || (caster == victim) || !caster->IsInWorld() || !caster->IsAlive())
2410 continue;
2411
2412 // Limit effect range to spell's cast range. (Only for single target auras, AreaAuras don't need it)
2413 // Ignore LOS attribute is only used for the cast portion of the spell
2414 SpellInfo const* splitSpellInfo = (*itr)->GetSpellInfo();
2415 if (!splitSpellInfo->Effects[(*itr)->GetEffIndex()].IsAreaAuraEffect())
2416 if (!caster->IsWithinDist(victim, splitSpellInfo->GetMaxRange(splitSpellInfo->IsPositive(), caster)))
2417 continue;
2418
2419 uint32 splitDamage = CalculatePct(dmgInfo.GetDamage(), (*itr)->GetAmount());
2420 SpellSchoolMask splitSchoolMask = schoolMask;
2421
2422 (*itr)->GetBase()->CallScriptEffectSplitHandlers(*itr, aurApp, dmgInfo, splitDamage);
2423
2424 // absorb must be smaller than the damage itself
2425 splitDamage = RoundToInterval(splitDamage, uint32(0), uint32(dmgInfo.GetDamage()));
2426
2427 // Roar of Sacrifice, dont absorb it
2428 if (splitSpellInfo->Id != 53480)
2429 dmgInfo.AbsorbDamage(splitDamage);
2430 else
2431 splitSchoolMask = SPELL_SCHOOL_MASK_NATURE;
2432
2433 uint32 splitted = splitDamage;
2434 uint32 splitted_absorb = 0;
2435 uint32 splitted_resist = 0;
2436
2437 uint32 procAttacker = 0, procVictim = 0, procEx = PROC_EX_NORMAL_HIT;
2438 DamageInfo splittedDmgInfo(attacker, caster, splitted, spellInfo, splitSchoolMask, dmgInfo.GetDamageType());
2439 if (caster->IsImmunedToDamageOrSchool(schoolMask))
2440 {
2441 procEx |= PROC_EX_IMMUNE;
2442 splittedDmgInfo.AbsorbDamage(splitted);
2443 }
2444 else
2445 {
2446 Unit::CalcAbsorbResist(splittedDmgInfo, true);
2447 Unit::DealDamageMods(caster, splitted, &splitted_absorb);
2448 }
2449
2450 splitted_absorb = splittedDmgInfo.GetAbsorb();
2451 splitted_resist = splittedDmgInfo.GetResist();
2452 splitted = splittedDmgInfo.GetDamage();
2453
2454 // create procs
2455 createProcFlags(spellInfo, BASE_ATTACK, false, procAttacker, procVictim);
2456 caster->ProcDamageAndSpellFor(true, attacker, procVictim, procEx, BASE_ATTACK, spellInfo, splitted);
2457
2458 if (attacker)
2459 {
2460 attacker->SendSpellNonMeleeDamageLog(caster, splitSpellInfo, splitted, splitSchoolMask, splitted_absorb, splitted_resist, false, 0, false, true);
2461 }
2462
2463 CleanDamage cleanDamage = CleanDamage(splitted, 0, BASE_ATTACK, MELEE_HIT_NORMAL);
2464 Unit::DealDamage(attacker, caster, splitted, &cleanDamage, DIRECT_DAMAGE, splitSchoolMask, splitSpellInfo, false);
2465 }
2466 }
2467}
@ PROC_EX_NORMAL_HIT
Definition: SpellMgr.h:194
@ PROC_EX_IMMUNE
Definition: SpellMgr.h:202
@ SPELL_AURA_MANA_SHIELD
Definition: SpellAuraDefines.h:160
@ SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL
Definition: SpellAuraDefines.h:257
@ SPELL_AURA_MOD_IGNORE_TARGET_RESIST
Definition: SpellAuraDefines.h:332
@ SPELL_AURA_SPLIT_DAMAGE_FLAT
Definition: SpellAuraDefines.h:216
@ SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL
Definition: SpellAuraDefines.h:258
@ SPELL_AURA_SPLIT_DAMAGE_PCT
Definition: SpellAuraDefines.h:144
@ SPELL_AURA_SCHOOL_ABSORB
Definition: SpellAuraDefines.h:132
@ SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST
Definition: SpellAuraDefines.h:333
@ AURA_REMOVE_BY_ENEMY_SPELL
Definition: SpellAuraDefines.h:394
@ SPELL_ATTR0_CU_BINARY_SPELL
Definition: SpellInfo.h:196
@ SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC
Definition: SpellInfo.h:199
void createProcFlags(SpellInfo const *spellInfo, WeaponAttackType attackType, bool positive, uint32 &procAttacker, uint32 &procVictim)
Definition: Unit.cpp:15848
@ DIRECT_DAMAGE
Definition: Unit.h:248
@ MELEE_HIT_NORMAL
Definition: Unit.h:286
@ POWER_MANA
Definition: SharedDefines.h:269
@ SPELL_ATTR4_NO_CAST_LOG
Definition: SharedDefines.h:530
SpellSchoolMask
Definition: SharedDefines.h:295
@ SPELL_SCHOOL_MASK_NORMAL
Definition: SharedDefines.h:297
@ SPELL_SCHOOL_MASK_NATURE
Definition: SharedDefines.h:300
@ SPELL_SCHOOL_MASK_HOLY
Definition: SharedDefines.h:298
double rand_norm()
Definition: Random.cpp:77
T AddPct(T &base, U pct)
Definition: Util.h:67
T RoundToInterval(T &num, T floor, T ceil)
Definition: Util.h:79
T CalculatePct(T base, U pct)
Definition: Util.h:61
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1316
Definition: Unit.h:315
void ResistDamage(uint32 amount)
Definition: Unit.cpp:159
void AbsorbDamage(uint32 amount)
Definition: Unit.cpp:152
Unit * GetVictim() const
Definition: Unit.h:359
Unit * GetAttacker() const
Definition: Unit.h:358
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:360
DamageEffectType GetDamageType() const
Definition: Unit.h:362
SpellSchoolMask GetSchoolMask() const
Definition: Unit.h:361
uint32 GetDamage() const
Definition: Unit.h:364
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:14078
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1310
static uint32 CalcArmorReducedDamage(Unit const *attacker, Unit const *victim, const uint32 damage, SpellInfo const *spellInfo, uint8 attackerLevel=0, WeaponAttackType attackType=MAX_ATTACK)
Definition: Unit.cpp:1998
static float GetEffectiveResistChance(Unit const *owner, SpellSchoolMask schoolMask, Unit const *victim)
Definition: Unit.cpp:2080
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log)
Definition: Unit.cpp:6261
void ProcDamageAndSpellFor(bool isVictim, Unit *target, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const *procSpellInfo, uint32 damage, SpellInfo const *procAura=nullptr, int8 procAuraEffectIndex=-1, Spell const *procSpell=nullptr, DamageInfo *damageInfo=nullptr, HealInfo *healInfo=nullptr, uint32 procPhase=2)
Definition: Unit.cpp:15982
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:646
bool IsImmunedToDamageOrSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12836
static void CalcAbsorbResist(DamageInfo &dmgInfo, bool Splited=false)
Definition: Unit.cpp:2114
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition: Unit.cpp:797
Definition: SpellAuraEffects.h:39
SpellInfo const * GetSpellInfo() const
Definition: SpellAuraEffects.h:54
void SetAmount(int32 amount)
Definition: SpellAuraEffects.h:66
Unit * GetCaster() const
Definition: SpellAuraEffects.h:47
int32 GetMiscValue() const
Definition: SpellAuraEffects.cpp:442
Aura * GetBase() const
Definition: SpellAuraEffects.h:49
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:56
int32 GetAmount() const
Definition: SpellAuraEffects.h:64
Definition: SpellAuraEffects.h:349
void CallScriptEffectAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition: SpellAuras.cpp:2559
void CallScriptEffectAfterAbsorbHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition: SpellAuras.cpp:2577
void CallScriptEffectManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
Definition: SpellAuras.cpp:2591
void CallScriptEffectAfterManaShieldHandlers(AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
Definition: SpellAuras.cpp:2605
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
std::array< SpellEffectInfo, MAX_SPELL_EFFECTS > Effects
Definition: SpellInfo.h:393
float GetMaxRange(bool positive=false, Unit *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:2322
bool IsPositive() const
Definition: SpellInfo.cpp:1236

References DamageInfo::AbsorbDamage(), AddPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, CalcAbsorbResist(), CalcArmorReducedDamage(), CalculatePct(), Aura::CallScriptEffectAbsorbHandlers(), Aura::CallScriptEffectAfterAbsorbHandlers(), Aura::CallScriptEffectAfterManaShieldHandlers(), Aura::CallScriptEffectManaShieldHandlers(), createProcFlags(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, SpellInfo::Effects, DamageInfo::GetAbsorb(), AuraEffect::GetAmount(), Aura::GetApplicationOfTarget(), DamageInfo::GetAttacker(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraApplication::GetBase(), AuraEffect::GetCaster(), DamageInfo::GetDamage(), DamageInfo::GetDamageType(), GetEffectiveResistChance(), AuraEffect::GetEffIndex(), Object::GetGUID(), SpellInfo::GetMaxRange(), AuraEffect::GetMiscValue(), DamageInfo::GetResist(), DamageInfo::GetSchoolMask(), DamageInfo::GetSpellInfo(), AuraEffect::GetSpellInfo(), Object::GetTypeId(), DamageInfo::GetVictim(), SpellInfo::HasAttribute(), SpellInfo::Id, IsAlive(), IsImmunedToDamageOrSchool(), Object::IsInWorld(), SpellInfo::IsPositive(), WorldObject::IsWithinDist(), MELEE_HIT_NORMAL, ModifyPower(), POWER_MANA, PROC_EX_IMMUNE, PROC_EX_NORMAL_HIT, ProcDamageAndSpellFor(), rand_norm(), Aura::Remove(), DamageInfo::ResistDamage(), RoundToInterval(), SendSpellNonMeleeDamageLog(), AuraEffect::SetAmount(), SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC, SPELL_ATTR4_NO_CAST_LOG, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL, SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SPLIT_DAMAGE_FLAT, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NATURE, SPELL_SCHOOL_MASK_NORMAL, and TYPEID_UNIT.

Referenced by CalcAbsorbResist(), CalculateSpellDamageTaken(), DealDamage(), DealMeleeDamage(), Player::EnvironmentalDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript().

◆ CalcArmorReducedDamage()

uint32 Unit::CalcArmorReducedDamage ( Unit const *  attacker,
Unit const *  victim,
const uint32  damage,
SpellInfo const *  spellInfo,
uint8  attackerLevel = 0,
WeaponAttackType  attackType = MAX_ATTACK 
)
static
1999{
2000 float armor = float(victim->GetArmor());
2001
2002 // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura
2003 if (attacker)
2004 {
2005 armor += attacker->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL);
2006
2007 if (spellInfo)
2008 if (Player* modOwner = attacker->GetSpellModOwner())
2009 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
2010
2011 AuraEffectList const& ResIgnoreAurasAb = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
2012 for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j)
2013 {
2014 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
2015 && (*j)->IsAffectedOnSpell(spellInfo))
2016 armor = floor(AddPct(armor, -(*j)->GetAmount()));
2017 }
2018
2019 AuraEffectList const& ResIgnoreAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
2020 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
2021 {
2022 if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
2023 armor = floor(AddPct(armor, -(*j)->GetAmount()));
2024 }
2025
2026 // Apply Player CR_ARMOR_PENETRATION rating and buffs from stances\specializations etc.
2027 if (attacker->IsPlayer())
2028 {
2029 float bonusPct = 0;
2030 AuraEffectList const& armorPenAuras = attacker->GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
2031 for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr)
2032 {
2033 if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
2034 {
2035 if (!spellInfo || (*itr)->IsAffectedOnSpell(spellInfo) || (*itr)->GetMiscValue() & spellInfo->GetSchoolMask())
2036 bonusPct += (*itr)->GetAmount();
2037 else if (!(*itr)->GetMiscValue() && !(*itr)->HasSpellClassMask())
2038 bonusPct += (*itr)->GetAmount();
2039 }
2040 else
2041 {
2042 if (attacker->ToPlayer()->HasItemFitToSpellRequirements((*itr)->GetSpellInfo()))
2043 bonusPct += (*itr)->GetAmount();
2044 }
2045 }
2046
2047 float maxArmorPen = 0;
2048 if (victim->GetLevel() < 60)
2049 maxArmorPen = float(400 + 85 * victim->GetLevel());
2050 else
2051 maxArmorPen = 400 + 85 * victim->GetLevel() + 4.5f * 85 * (victim->GetLevel() - 59);
2052
2053 // Cap armor penetration to this number
2054 maxArmorPen = std::min((armor + maxArmorPen) / 3, armor);
2055 // Figure out how much armor do we ignore
2056 float armorPen = CalculatePct(maxArmorPen, bonusPct + attacker->ToPlayer()->GetRatingBonusValue(CR_ARMOR_PENETRATION));
2057 // Got the value, apply it
2058 armor -= std::min(armorPen, maxArmorPen);
2059 }
2060 }
2061
2062 if (armor < 0.0f)
2063 armor = 0.0f;
2064
2065 float levelModifier = attacker ? attacker->GetLevel() : attackerLevel;
2066 if (levelModifier > 59)
2067 levelModifier = levelModifier + (4.5f * (levelModifier - 59));
2068
2069 float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40);
2070 tmpvalue = tmpvalue / (1.0f + tmpvalue);
2071
2072 if (tmpvalue < 0.0f)
2073 tmpvalue = 0.0f;
2074 if (tmpvalue > 0.75f)
2075 tmpvalue = 0.75f;
2076
2077 return uint32(std::ceil(std::max(damage * (1.0f - tmpvalue), 0.0f)));
2078}
@ SPELLMOD_IGNORE_ARMOR
Definition: SpellDefines.h:90
@ SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
Definition: SpellAuraDefines.h:343
@ SPELL_AURA_MOD_TARGET_RESISTANCE
Definition: SpellAuraDefines.h:186
@ CR_ARMOR_PENETRATION
Definition: Unit.h:241

References AddPct(), CalculatePct(), CR_ARMOR_PENETRATION, GetArmor(), GetAuraEffectsByType(), GetLevel(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), Player::HasItemFitToSpellRequirements(), SpellInfo::Id, Object::IsPlayer(), SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_ARMOR_PENETRATION_PCT, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_TARGET_RESISTANCE, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_IGNORE_ARMOR, and Object::ToPlayer().

Referenced by CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), boss_priestess_lackey_commonAI::GetThreatMod(), boss_faction_championsAI::GetThreatMod(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ CalcHealAbsorb()

void Unit::CalcHealAbsorb ( HealInfo healInfo)
static
2470{
2471 if (!healInfo.GetHeal())
2472 return;
2473
2474 int32 const healing = static_cast<int32>(healInfo.GetHeal());
2475 int32 absorbAmount = 0;
2476
2477 // Need remove expired auras after
2478 bool existExpired = false;
2479
2480 // absorb without mana cost
2482 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end() && absorbAmount <= healing; ++i)
2483 {
2484 if (!((*i)->GetMiscValue() & healInfo.GetSpellInfo()->SchoolMask))
2485 continue;
2486
2487 // Max Amount can be absorbed by this aura
2488 int32 currentAbsorb = (*i)->GetAmount();
2489
2490 // Found empty aura (impossible but..)
2491 if (currentAbsorb <= 0)
2492 {
2493 existExpired = true;
2494 continue;
2495 }
2496
2497 // currentAbsorb - damage can be absorbed by shield
2498 // If need absorb less damage
2499 if (healing < currentAbsorb + absorbAmount)
2500 currentAbsorb = healing - absorbAmount;
2501
2502 absorbAmount += currentAbsorb;
2503
2504 // Reduce shield amount
2505 (*i)->SetAmount((*i)->GetAmount() - currentAbsorb);
2506 // Need remove it later
2507 if ((*i)->GetAmount() <= 0)
2508 existExpired = true;
2509 }
2510
2511 // Remove all expired absorb auras
2512 if (existExpired)
2513 {
2514 for (AuraEffectList::const_iterator i = vHealAbsorb.begin(); i != vHealAbsorb.end();)
2515 {
2516 AuraEffect* auraEff = *i;
2517 ++i;
2518 if (auraEff->GetAmount() <= 0)
2519 {
2520 uint32 removedAuras = healInfo.GetTarget()->m_removedAurasCount;
2522 if (removedAuras + 1 < healInfo.GetTarget()->m_removedAurasCount)
2523 i = vHealAbsorb.begin();
2524 }
2525 }
2526 }
2527
2528 if (absorbAmount > 0)
2529 healInfo.AbsorbHeal(absorbAmount);
2530}
@ SPELL_AURA_SCHOOL_HEAL_ABSORB
Definition: SpellAuraDefines.h:364
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:415
void AbsorbHeal(uint32 amount)
Definition: Unit.h:390
Unit * GetTarget() const
Definition: Unit.h:411
uint32 GetHeal() const
Definition: Unit.h:412
uint32 SchoolMask
Definition: SpellInfo.h:392

References HealInfo::AbsorbHeal(), AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::GetAmount(), GetAuraEffectsByType(), AuraEffect::GetBase(), HealInfo::GetHeal(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), m_removedAurasCount, Aura::Remove(), SpellInfo::SchoolMask, and SPELL_AURA_SCHOOL_HEAL_ABSORB.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), and HealBySpell().

◆ CalcSpellDuration()

int32 Unit::CalcSpellDuration ( SpellInfo const *  spellProto)
14784{
14785 uint8 comboPoints = GetComboPoints();
14786
14787 int32 minduration = spellProto->GetDuration();
14788 int32 maxduration = spellProto->GetMaxDuration();
14789
14790 int32 duration;
14791
14792 if (comboPoints && minduration != -1 && minduration != maxduration)
14793 duration = minduration + int32((maxduration - minduration) * comboPoints / 5);
14794 else
14795 duration = minduration;
14796
14797 return duration;
14798}
uint8 GetComboPoints(Unit const *who=nullptr) const
--------—Combo point system----------------—
Definition: Unit.h:1633

References GetComboPoints(), SpellInfo::GetDuration(), and SpellInfo::GetMaxDuration().

Referenced by Aura::CalcMaxDuration(), Spell::EffectInterruptCast(), Spell::EffectSchoolDMG(), and Aura::HandleAuraSpecificMods().

◆ CalculateAOEDamageReduction()

int32 Unit::CalculateAOEDamageReduction ( int32  damage,
uint32  schoolMask,
Unit caster 
) const
20298{
20299 damage = int32(float(damage) * GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, schoolMask));
20300 if (caster && caster->GetTypeId() == TYPEID_UNIT)
20302
20303 return damage;
20304}
@ SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE
Definition: SpellAuraDefines.h:373
@ SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
Definition: SpellAuraDefines.h:292
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5925

References GetTotalAuraMultiplierByMiscMask(), Object::GetTypeId(), SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE, SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE, and TYPEID_UNIT.

Referenced by Spell::DoAllEffectOnLaunchTarget(), AuraEffect::HandlePeriodicDamageAurasTick(), and spell_dk_death_and_decay::RecalculateDamage().

◆ CalculateDamage()

uint32 Unit::CalculateDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
uint8  itemDamagesMask = 0 
)
2952{
2953 float minDamage = 0.0f;
2954 float maxDamage = 0.0f;
2955
2956 if (normalized || !addTotalPct || itemDamagesMask)
2957 {
2958 // get both by default
2959 if (!itemDamagesMask)
2960 {
2961 itemDamagesMask = (1 << 0) | (1 << 1);
2962 }
2963
2964 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
2965 {
2966 if (itemDamagesMask & (1 << i))
2967 {
2968 float minTmp, maxTmp;
2969 CalculateMinMaxDamage(attType, normalized, addTotalPct, minTmp, maxTmp, i);
2970 minDamage += minTmp;
2971 maxDamage += maxTmp;
2972 }
2973 }
2974 }
2975 else
2976 {
2977 switch (attType)
2978 {
2979 case RANGED_ATTACK:
2982 break;
2983 case BASE_ATTACK:
2986 break;
2987 case OFF_ATTACK:
2990 break;
2991 default:
2992 break;
2993 }
2994 }
2995
2996 minDamage = std::max(0.f, minDamage);
2997 maxDamage = std::max(0.f, maxDamage);
2998
2999 if (minDamage > maxDamage)
3000 {
3001 std::swap(minDamage, maxDamage);
3002 }
3003
3004 return urand(uint32(minDamage), uint32(maxDamage));
3005}
@ UNIT_FIELD_MINDAMAGE
Definition: UpdateFields.h:127
@ UNIT_FIELD_MAXDAMAGE
Definition: UpdateFields.h:128
@ UNIT_FIELD_MAXOFFHANDDAMAGE
Definition: UpdateFields.h:130
@ UNIT_FIELD_MAXRANGEDDAMAGE
Definition: UpdateFields.h:169
@ UNIT_FIELD_MINRANGEDDAMAGE
Definition: UpdateFields.h:168
@ UNIT_FIELD_MINOFFHANDDAMAGE
Definition: UpdateFields.h:129
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317
virtual void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float &minDamage, float &maxDamage, uint8 damageIndex=0)=0

References BASE_ATTACK, CalculateMinMaxDamage(), Object::GetFloatValue(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, UNIT_FIELD_MINRANGEDDAMAGE, and urand().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ CalculateDefaultCoefficient()

float Unit::CalculateDefaultCoefficient ( SpellInfo const *  spellInfo,
DamageEffectType  damagetype 
) const
17125{
17126 // Damage over Time spells bonus calculation
17127 float DotFactor = 1.0f;
17128 if (damagetype == DOT)
17129 {
17130 int32 DotDuration = spellInfo->GetDuration();
17131 if (!spellInfo->IsChanneled() && DotDuration > 0)
17132 DotFactor = DotDuration / 15000.0f;
17133
17134 if (uint32 DotTicks = spellInfo->GetMaxTicks())
17135 DotFactor /= DotTicks;
17136 }
17137
17138 int32 CastingTime = spellInfo->IsChanneled() ? spellInfo->GetDuration() : spellInfo->CalcCastTime();
17139 // Distribute Damage over multiple effects, reduce by AoE
17140 CastingTime = GetCastingTimeForBonus(spellInfo, damagetype, CastingTime);
17141
17142 // As wowwiki says: C = (Cast Time / 3.5)
17143 return (CastingTime / 3500.0f) * DotFactor;
17144}
@ DOT
Definition: Unit.h:250
uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime) const
Definition: Unit.cpp:17006

References SpellInfo::CalcCastTime(), DOT, GetCastingTimeForBonus(), SpellInfo::GetDuration(), SpellInfo::GetMaxTicks(), and SpellInfo::IsChanneled().

Referenced by SpellDamageBonusTaken().

◆ CalculateLevelPenalty()

float Unit::CalculateLevelPenalty ( SpellInfo const *  spellProto) const
3008{
3009 if (GetTypeId() != TYPEID_PLAYER)
3010 return 1.0f;
3011
3012 if (spellProto->SpellLevel <= 0 || spellProto->SpellLevel >= spellProto->MaxLevel)
3013 return 1.0f;
3014
3015 float LvlPenalty = 0.0f;
3016
3017 // xinef: added brackets
3018 if (spellProto->SpellLevel < 20)
3019 LvlPenalty = (20.0f - spellProto->SpellLevel) * 3.75f;
3020
3021 float LvlFactor = (float(spellProto->SpellLevel) + 6.0f) / float(GetLevel());
3022 if (LvlFactor > 1.0f)
3023 LvlFactor = 1.0f;
3024
3025 return AddPct(LvlFactor, -LvlPenalty);
3026}
uint8 GetLevel() const
Definition: Unit.h:759

References AddPct(), GetLevel(), Object::GetTypeId(), SpellInfo::MaxLevel, SpellInfo::SpellLevel, and TYPEID_PLAYER.

Referenced by spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), CalculateSpellAmount(), SpellDamageBonusDone(), SpellDamageBonusTaken(), and SpellHealingBonusDone().

◆ CalculateMeleeDamage()

void Unit::CalculateMeleeDamage ( Unit victim,
CalcDamageInfo damageInfo,
WeaponAttackType  attackType = BASE_ATTACK,
const bool  sittingVictim = false 
)
1452{
1453 damageInfo->attacker = this;
1454 damageInfo->target = victim;
1455
1456 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1457 {
1458 damageInfo->damages[i].damageSchoolMask = GetMeleeDamageSchoolMask(attackType, i);
1459 damageInfo->damages[i].damage = 0;
1460 damageInfo->damages[i].absorb = 0;
1461 damageInfo->damages[i].resist = 0;
1462 }
1463
1464 damageInfo->attackType = attackType;
1465 damageInfo->cleanDamage = 0;
1466 damageInfo->blocked_amount = 0;
1467
1468 damageInfo->TargetState = 0;
1469 damageInfo->HitInfo = 0;
1470 damageInfo->procAttacker = PROC_FLAG_NONE;
1471 damageInfo->procVictim = PROC_FLAG_NONE;
1472 damageInfo->procEx = PROC_EX_NONE;
1473 damageInfo->hitOutCome = MELEE_HIT_EVADE;
1474
1475 if (!victim)
1476 return;
1477
1478 if (!IsAlive() || !victim->IsAlive())
1479 return;
1480
1481 // Select HitInfo/procAttacker/procVictim flag based on attack type
1482 switch (attackType)
1483 {
1484 case BASE_ATTACK:
1487 break;
1488 case OFF_ATTACK:
1491 damageInfo->HitInfo = HITINFO_OFFHAND;
1492 break;
1493 default:
1494 return;
1495 }
1496
1497 // School Immune check
1498 uint8 immunedMask = 0;
1499 bool hasNonPhysicalSchoolMask = false;
1500 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1501 {
1503 {
1504 immunedMask |= (1 << i);
1506 {
1507 hasNonPhysicalSchoolMask = true;
1508 }
1509 }
1510 }
1511
1512 // School Immune check
1513 if (immunedMask & ((1 << 0) | (1 << 1)))
1514 {
1515 if (hasNonPhysicalSchoolMask || immunedMask == ((1 << 0) | (1 << 1)))
1516 {
1517 damageInfo->HitInfo |= HITINFO_NORMALSWING;
1518 damageInfo->TargetState = VICTIMSTATE_IS_IMMUNE;
1519
1520 damageInfo->procEx |= PROC_EX_IMMUNE;
1521 return;
1522 }
1523 }
1524
1525 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1526 {
1527 // only players have secondary weapon damage
1528 if (i > 0 && GetTypeId() != TYPEID_PLAYER)
1529 {
1530 break;
1531 }
1532
1533 if (immunedMask & (1 << i))
1534 {
1535 continue;
1536 }
1537
1538 SpellSchoolMask schoolMask = SpellSchoolMask(damageInfo->damages[i].damageSchoolMask);
1539 bool const addPctMods = (schoolMask & SPELL_SCHOOL_MASK_NORMAL);
1540
1541 uint32 damage = 0;
1542 uint8 itemDamagesMask = (IsPlayer()) ? (1 << i) : 0;
1543
1544 damage += CalculateDamage(damageInfo->attackType, false, addPctMods, itemDamagesMask);
1545 // Add melee damage bonus
1546 damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType, nullptr, schoolMask);
1547 damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType, nullptr, schoolMask);
1548
1549 // Script Hook For CalculateMeleeDamage -- Allow scripts to change the Damage pre class mitigation calculations
1550 sScriptMgr->ModifyMeleeDamage(damageInfo->target, damageInfo->attacker, damage);
1551
1552 if (victim->GetAI())
1553 {
1554 victim->GetAI()->OnCalculateMeleeDamageReceived(damage, this);
1555 }
1556
1557 // Calculate armor reduction
1559 {
1560 damageInfo->damages[i].damage = Unit::CalcArmorReducedDamage(this, damageInfo->target, damage, nullptr, 0, damageInfo->attackType);
1561 damageInfo->cleanDamage += damage - damageInfo->damages[i].damage;
1562 }
1563 else
1564 {
1565 damageInfo->damages[i].damage = damage;
1566 }
1567 }
1568
1569 damageInfo->hitOutCome = RollMeleeOutcomeAgainst(damageInfo->target, damageInfo->attackType);
1570
1571 // If the victim was a sitting player and we didn't roll a miss, then crit.
1572 if (sittingVictim && damageInfo->hitOutCome != MELEE_HIT_MISS)
1573 {
1574 damageInfo->hitOutCome = MELEE_HIT_CRIT;
1575 }
1576 switch (damageInfo->hitOutCome)
1577 {
1578 case MELEE_HIT_EVADE:
1580 damageInfo->TargetState = VICTIMSTATE_EVADES;
1581 damageInfo->procEx |= PROC_EX_EVADE;
1582
1583 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1584 {
1585 damageInfo->damages[i].damage = 0;
1586 }
1587
1588 damageInfo->cleanDamage = 0;
1589 return;
1590 case MELEE_HIT_MISS:
1591 damageInfo->HitInfo |= HITINFO_MISS;
1592 damageInfo->TargetState = VICTIMSTATE_INTACT;
1593 damageInfo->procEx |= PROC_EX_MISS;
1594
1595 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1596 {
1597 damageInfo->damages[i].damage = 0;
1598 }
1599 damageInfo->cleanDamage = 0;
1600 break;
1601 case MELEE_HIT_NORMAL:
1602 damageInfo->TargetState = VICTIMSTATE_HIT;
1603 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1604 break;
1605 case MELEE_HIT_CRIT:
1606 {
1607 damageInfo->HitInfo |= HITINFO_CRITICALHIT;
1608 damageInfo->TargetState = VICTIMSTATE_HIT;
1609
1610 damageInfo->procEx |= PROC_EX_CRITICAL_HIT;
1611 // Crit bonus calc
1612 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1613 {
1614 damageInfo->damages[i].damage *= 2;
1615
1616 float mod = 0.0f;
1617 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1618 if (damageInfo->attackType == RANGED_ATTACK)
1619 {
1621 }
1622 else
1623 {
1625
1626 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1628 }
1629
1630 uint32 crTypeMask = damageInfo->target->GetCreatureTypeMask();
1631
1632 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1634 if (mod != 0)
1635 {
1636 AddPct(damageInfo->damages[i].damage, mod);
1637 }
1638 }
1639 break;
1640 }
1641 case MELEE_HIT_PARRY:
1642 damageInfo->TargetState = VICTIMSTATE_PARRY;
1643 damageInfo->procEx |= PROC_EX_PARRY;
1644 damageInfo->cleanDamage = 0;
1645
1646 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1647 {
1648 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1649 damageInfo->damages[i].damage = 0;
1650 }
1651 break;
1652 case MELEE_HIT_DODGE:
1653 damageInfo->TargetState = VICTIMSTATE_DODGE;
1654 damageInfo->procEx |= PROC_EX_DODGE;
1655 damageInfo->cleanDamage = 0;
1656
1657 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1658 {
1659 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1660 damageInfo->damages[i].damage = 0;
1661 }
1662 break;
1663 case MELEE_HIT_BLOCK:
1664 {
1665 damageInfo->TargetState = VICTIMSTATE_HIT;
1666 damageInfo->HitInfo |= HITINFO_BLOCK;
1667 damageInfo->procEx |= PROC_EX_BLOCK;
1668 damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue();
1669 // double blocked amount if block is critical
1670 if (damageInfo->target->isBlockCritical())
1671 damageInfo->blocked_amount += damageInfo->blocked_amount;
1672
1673 uint32 remainingBlock = damageInfo->blocked_amount;
1674 uint8 fullBlockMask = 0;
1675 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1676 {
1677 if (remainingBlock && remainingBlock >= damageInfo->damages[i].damage)
1678 {
1679 fullBlockMask |= (1 << i);
1680
1681 remainingBlock -= damageInfo->damages[i].damage;
1682 damageInfo->cleanDamage += damageInfo->damages[i].damage;
1683 damageInfo->damages[i].damage = 0;
1684 }
1685 else
1686 {
1687 damageInfo->cleanDamage += remainingBlock;
1688 damageInfo->damages[i].damage -= remainingBlock;
1689 remainingBlock = 0;
1690 }
1691 }
1692
1693 // full block
1694 if (fullBlockMask == ((1 << 0) | (1 << 1)))
1695 {
1696 damageInfo->TargetState = VICTIMSTATE_BLOCKS;
1697 damageInfo->procEx |= PROC_EX_FULL_BLOCK;
1698 damageInfo->blocked_amount -= remainingBlock;
1699 }
1700 break;
1701 }
1702 case MELEE_HIT_GLANCING:
1703 {
1704 damageInfo->HitInfo |= HITINFO_GLANCING;
1705 damageInfo->TargetState = VICTIMSTATE_HIT;
1706 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1707 int32 leveldif = int32(victim->GetLevel()) - int32(GetLevel());
1708 if (leveldif > 3)
1709 leveldif = 3;
1710 float reducePercent = 1 - leveldif * 0.1f;
1711
1712 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1713 {
1714 uint32 reducedDamage = uint32(reducePercent * damageInfo->damages[i].damage);
1715 damageInfo->cleanDamage += damageInfo->damages[i].damage - reducedDamage;
1716 damageInfo->damages[i].damage = reducedDamage;
1717 }
1718 break;
1719 }
1720 case MELEE_HIT_CRUSHING:
1721 damageInfo->HitInfo |= HITINFO_CRUSHING;
1722 damageInfo->TargetState = VICTIMSTATE_HIT;
1723 damageInfo->procEx |= PROC_EX_NORMAL_HIT;
1724
1725 // 150% normal damage
1726 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1727 {
1728 damageInfo->damages[i].damage += (damageInfo->damages[i].damage / 2);
1729 }
1730 break;
1731 default:
1732 break;
1733 }
1734
1735 // Always apply HITINFO_AFFECTS_VICTIM in case its not a miss
1736 if (!(damageInfo->HitInfo & HITINFO_MISS))
1737 damageInfo->HitInfo |= HITINFO_AFFECTS_VICTIM;
1738
1739 uint32 tmpHitInfo[MAX_ITEM_PROTO_DAMAGES] = { };
1740
1741 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1742 {
1743 int32 dmg = damageInfo->damages[i].damage;
1744 int32 cleanDamage = damageInfo->cleanDamage;
1745 // attackType is checked already for BASE_ATTACK or OFF_ATTACK so it can't be RANGED_ATTACK here
1746 if (CanApplyResilience())
1747 {
1748 int32 resilienceReduction = damageInfo->damages[i].damage;
1749 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, (damageInfo->hitOutCome == MELEE_HIT_CRIT), CR_CRIT_TAKEN_MELEE);
1750
1751 resilienceReduction = damageInfo->damages[i].damage - resilienceReduction;
1752 dmg -= resilienceReduction;
1753 cleanDamage += resilienceReduction;
1754 }
1755
1756 damageInfo->damages[i].damage = std::max(0, dmg);
1757 damageInfo->cleanDamage = std::max(0, cleanDamage);
1758
1759 // Calculate absorb resist
1760 if (damageInfo->damages[i].damage > 0)
1761 {
1762 damageInfo->procVictim |= PROC_FLAG_TAKEN_DAMAGE;
1763
1764 // Calculate absorb & resists
1765 DamageInfo dmgInfo(*damageInfo, i);
1766 Unit::CalcAbsorbResist(dmgInfo);
1767 damageInfo->damages[i].absorb = dmgInfo.GetAbsorb();
1768 damageInfo->damages[i].resist = dmgInfo.GetResist();
1769
1770 if (damageInfo->damages[i].absorb)
1771 {
1772 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].absorb == 0 ? HITINFO_FULL_ABSORB : HITINFO_PARTIAL_ABSORB);
1773 }
1774
1775 if (damageInfo->damages[i].resist)
1776 {
1777 tmpHitInfo[i] |= (damageInfo->damages[i].damage - damageInfo->damages[i].resist == 0 ? HITINFO_FULL_RESIST : HITINFO_PARTIAL_RESIST);
1778 }
1779
1780 damageInfo->damages[i].damage = dmgInfo.GetDamage();
1781 }
1782 }
1783
1784 // set proper HitInfo flags
1785 if ((tmpHitInfo[0] & HITINFO_FULL_ABSORB) != 0)
1786 {
1787 // set partial absorb when secondary damage isn't full absorbed
1788 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_ABSORB) != 0) ? HITINFO_PARTIAL_ABSORB : HITINFO_FULL_ABSORB;
1789 }
1790 else
1791 {
1792 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_ABSORB);
1793 }
1794
1795 if ((tmpHitInfo[0] & HITINFO_FULL_RESIST) != 0)
1796 {
1797 // set partial resist when secondary damage isn't full resisted
1798 damageInfo->HitInfo |= ((tmpHitInfo[1] & HITINFO_PARTIAL_RESIST) != 0) ? HITINFO_PARTIAL_RESIST : HITINFO_FULL_RESIST;
1799 }
1800 else
1801 {
1802 damageInfo->HitInfo |= (tmpHitInfo[0] & HITINFO_PARTIAL_RESIST);
1803 }
1804
1806 {
1807 damageInfo->procEx |= PROC_EX_ABSORB;
1808 }
1809
1810 if (damageInfo->HitInfo & HITINFO_FULL_RESIST)
1811 {
1812 damageInfo->procEx |= PROC_EX_RESIST;
1813 }
1814}
@ PROC_EX_NONE
Definition: SpellMgr.h:193
@ PROC_EX_DODGE
Definition: SpellMgr.h:198
@ PROC_EX_BLOCK
Definition: SpellMgr.h:200
@ PROC_EX_CRITICAL_HIT
Definition: SpellMgr.h:195
@ PROC_EX_MISS
Definition: SpellMgr.h:196
@ PROC_EX_RESIST
Definition: SpellMgr.h:197
@ PROC_EX_FULL_BLOCK
Definition: SpellMgr.h:207
@ PROC_EX_ABSORB
Definition: SpellMgr.h:204
@ PROC_EX_PARRY
Definition: SpellMgr.h:199
@ PROC_EX_EVADE
Definition: SpellMgr.h:201
@ PROC_FLAG_DONE_MELEE_AUTO_ATTACK
Definition: SpellMgr.h:110
@ PROC_FLAG_DONE_MAINHAND_ATTACK
Definition: SpellMgr.h:140
@ PROC_FLAG_TAKEN_DAMAGE
Definition: SpellMgr.h:137
@ PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
Definition: SpellMgr.h:111
@ PROC_FLAG_DONE_OFFHAND_ATTACK
Definition: SpellMgr.h:141
@ PROC_FLAG_NONE
Definition: SpellMgr.h:105
@ SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
Definition: SpellAuraDefines.h:232
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE
Definition: SpellAuraDefines.h:267
@ SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
Definition: SpellAuraDefines.h:226
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
Definition: SpellAuraDefines.h:266
@ VICTIMSTATE_INTACT
Definition: Unit.h:83
@ VICTIMSTATE_HIT
Definition: Unit.h:84
@ VICTIMSTATE_DODGE
Definition: Unit.h:85
@ VICTIMSTATE_IS_IMMUNE
Definition: Unit.h:90
@ VICTIMSTATE_PARRY
Definition: Unit.h:86
@ VICTIMSTATE_BLOCKS
Definition: Unit.h:88
@ VICTIMSTATE_EVADES
Definition: Unit.h:89
@ HITINFO_PARTIAL_ABSORB
Definition: Unit.h:103
@ HITINFO_FULL_RESIST
Definition: Unit.h:104
@ HITINFO_NORMALSWING
Definition: Unit.h:96
@ HITINFO_BLOCK
Definition: Unit.h:110
@ HITINFO_CRUSHING
Definition: Unit.h:114
@ HITINFO_SWINGNOHITSOUND
Definition: Unit.h:118
@ HITINFO_MISS
Definition: Unit.h:101
@ HITINFO_FULL_ABSORB
Definition: Unit.h:102
@ HITINFO_OFFHAND
Definition: Unit.h:99
@ HITINFO_GLANCING
Definition: Unit.h:113
@ HITINFO_CRITICALHIT
Definition: Unit.h:106
@ HITINFO_PARTIAL_RESIST
Definition: Unit.h:105
@ HITINFO_AFFECTS_VICTIM
Definition: Unit.h:98
@ MELEE_HIT_CRUSHING
Definition: Unit.h:286
@ MELEE_HIT_BLOCK
Definition: Unit.h:285
@ MELEE_HIT_CRIT
Definition: Unit.h:286
@ MELEE_HIT_EVADE
Definition: Unit.h:285
@ MELEE_HIT_DODGE
Definition: Unit.h:285
@ MELEE_HIT_MISS
Definition: Unit.h:285
@ MELEE_HIT_PARRY
Definition: Unit.h:285
@ MELEE_HIT_GLANCING
Definition: Unit.h:286
virtual void OnCalculateMeleeDamageReceived(uint32 &, Unit *)
Called during damage calculations.
Definition: UnitAI.h:381
uint32 damageSchoolMask
Definition: Unit.h:469
uint32 blocked_amount
Definition: Unit.h:475
MeleeHitOutcome hitOutCome
Definition: Unit.h:484
uint32 cleanDamage
Definition: Unit.h:483
uint32 TargetState
Definition: Unit.h:477
uint32 resist
Definition: Unit.h:472
uint32 HitInfo
Definition: Unit.h:476
bool isBlockCritical()
Definition: Unit.cpp:3093
uint32 MeleeDamageBonusTaken(Unit *attacker, uint32 pdamage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition: Unit.cpp:13211
virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType=BASE_ATTACK, uint8 damageIndex=0) const =0
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5912
bool CanApplyResilience() const
Definition: Unit.h:1770
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, uint8 itemDamagesMask=0)
Definition: Unit.cpp:2951
virtual uint32 GetShieldBlockValue() const =0
static void ApplyResilience(Unit const *victim, float *crit, int32 *damage, bool isCrit, CombatRating type)
Definition: Unit.cpp:18844
UnitAI * GetAI()
Definition: Unit.h:656
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo=nullptr, uint8 effIndex=MAX_SPELL_EFFECTS)
Definition: Unit.cpp:1975
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5861
MeleeHitOutcome RollMeleeOutcomeAgainst(Unit const *victim, WeaponAttackType attType) const
Definition: Unit.cpp:2748
uint32 GetCreatureTypeMask() const
Definition: Unit.h:873
uint32 MeleeDamageBonusDone(Unit *pVictim, uint32 damage, WeaponAttackType attType, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition: Unit.cpp:13009

References CalcDamageInfo::absorb, AddPct(), CalcDamageInfo::attacker, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcArmorReducedDamage(), CalculateDamage(), CalcDamageInfo::cleanDamage, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, GetAI(), GetCreatureTypeMask(), GetLevel(), GetMeleeDamageSchoolMask(), GetShieldBlockValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), GetTotalAuraMultiplierByMiscMask(), Object::GetTypeId(), CalcDamageInfo::HitInfo, HITINFO_AFFECTS_VICTIM, HITINFO_BLOCK, HITINFO_CRITICALHIT, HITINFO_CRUSHING, HITINFO_GLANCING, HITINFO_MISS, HITINFO_NORMALSWING, HITINFO_OFFHAND, HITINFO_SWINGNOHITSOUND, CalcDamageInfo::hitOutCome, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), IsImmunedToDamageOrSchool(), Object::IsPlayer(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, MeleeDamageBonusDone(), MeleeDamageBonusTaken(), OFF_ATTACK, UnitAI::OnCalculateMeleeDamageReceived(), PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_EVADE, PROC_EX_FULL_BLOCK, PROC_EX_IMMUNE, PROC_EX_MISS, PROC_EX_NONE, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_MELEE_AUTO_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_NONE, PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK, CalcDamageInfo::procAttacker, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, RANGED_ATTACK, CalcDamageInfo::resist, RollMeleeOutcomeAgainst(), SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_SCHOOL_MASK_NORMAL, sScriptMgr, CalcDamageInfo::target, CalcDamageInfo::TargetState, TYPEID_PLAYER, VICTIMSTATE_BLOCKS, VICTIMSTATE_DODGE, VICTIMSTATE_EVADES, VICTIMSTATE_HIT, VICTIMSTATE_INTACT, VICTIMSTATE_IS_IMMUNE, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ CalculateMinMaxDamage()

virtual void Unit::CalculateMinMaxDamage ( WeaponAttackType  attType,
bool  normalized,
bool  addTotalPct,
float &  minDamage,
float &  maxDamage,
uint8  damageIndex = 0 
)
pure virtual

Implemented in Creature, and Player.

Referenced by CalculateDamage(), and UpdateDamagePhysical().

◆ CalculateSpellDamage()

int32 Unit::CalculateSpellDamage ( Unit const *  target,
SpellInfo const *  spellProto,
uint8  effect_index,
int32 const *  basePoints = nullptr 
) const

◆ CalculateSpellDamageTaken()

void Unit::CalculateSpellDamageTaken ( SpellNonMeleeDamage damageInfo,
int32  damage,
SpellInfo const *  spellInfo,
WeaponAttackType  attackType = BASE_ATTACK,
bool  crit = false 
)
1283{
1284 if (damage < 0)
1285 return;
1286
1287 Unit* victim = damageInfo->target;
1288 if (!victim || !victim->IsAlive())
1289 return;
1290
1291 SpellSchoolMask damageSchoolMask = SpellSchoolMask(damageInfo->schoolMask);
1292 uint32 crTypeMask = victim->GetCreatureTypeMask();
1293
1294 // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations
1295 sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo);
1296
1297 if (victim->GetAI())
1298 {
1299 victim->GetAI()->OnCalculateSpellDamageReceived(damage, this);
1300 }
1301
1302 int32 cleanDamage = 0;
1303 if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo))
1304 {
1305 int32 oldDamage = damage;
1306 damage = Unit::CalcArmorReducedDamage(this, victim, damage, spellInfo, 0, attackType);
1307 cleanDamage = oldDamage - damage;
1308 }
1309
1310 bool blocked = false;
1311 // Per-school calc
1312 switch (spellInfo->DmgClass)
1313 {
1314 // Melee and Ranged Spells
1317 {
1318 // Physical Damage
1319 if (damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL)
1320 {
1321 // Get blocked status
1322 blocked = isSpellBlocked(victim, spellInfo, attackType);
1323 }
1324
1325 if (crit)
1326 {
1327 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1328
1329 // Calculate crit bonus
1330 uint32 crit_bonus = damage;
1331 // Apply crit_damage bonus for melee spells
1332 if (Player* modOwner = GetSpellModOwner())
1333 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
1334 damage += crit_bonus;
1335
1336 // Apply SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE or SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE
1337 float critPctDamageMod = 0.0f;
1338 if (attackType == RANGED_ATTACK)
1340 else
1342
1343 // Increase crit damage from SPELL_AURA_MOD_CRIT_DAMAGE_BONUS
1344 critPctDamageMod += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellInfo->GetSchoolMask());
1345
1346 // Increase crit damage from SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
1348
1349 if (critPctDamageMod != 0)
1350 AddPct(damage, critPctDamageMod);
1351 }
1352
1353 // Spell weapon based damage CAN BE crit & blocked at same time
1354 if (blocked)
1355 {
1356 damageInfo->blocked = victim->GetShieldBlockValue();
1357 // double blocked amount if block is critical
1358 if (victim->isBlockCritical())
1359 damageInfo->blocked *= 2;
1360 if (damage < int32(damageInfo->blocked))
1361 damageInfo->blocked = uint32(damage);
1362
1363 damage -= damageInfo->blocked;
1364 cleanDamage += damageInfo->blocked;
1365 }
1366
1367 int32 resilienceReduction = damage;
1368 if (CanApplyResilience())
1369 {
1370 if (attackType != RANGED_ATTACK)
1371 {
1372 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_MELEE);
1373 }
1374 else
1375 {
1376 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_RANGED);
1377 }
1378 }
1379
1380 resilienceReduction = damage - resilienceReduction;
1381 damage -= resilienceReduction;
1382 cleanDamage += resilienceReduction;
1383 break;
1384 }
1385 // Magical Attacks
1388 {
1389 // If crit add critical bonus
1390 if (crit)
1391 {
1392 damageInfo->HitInfo |= SPELL_HIT_TYPE_CRIT;
1393 damage = Unit::SpellCriticalDamageBonus(this, spellInfo, damage, victim);
1394 }
1395
1396 int32 resilienceReduction = damage;
1397 if (CanApplyResilience())
1398 {
1399 Unit::ApplyResilience(victim, nullptr, &resilienceReduction, crit, CR_CRIT_TAKEN_SPELL);
1400 }
1401
1402 resilienceReduction = damage - resilienceReduction;
1403 damage -= resilienceReduction;
1404 cleanDamage += resilienceReduction;
1405 break;
1406 }
1407 default:
1408 break;
1409 }
1410
1411 damageInfo->cleanDamage = std::max(0, cleanDamage);
1412 damageInfo->damage = std::max(0, damage);
1413
1414 // Calculate absorb resist
1415 if (damageInfo->damage > 0)
1416 {
1417 DamageInfo dmgInfo(*damageInfo, SPELL_DIRECT_DAMAGE);
1418 Unit::CalcAbsorbResist(dmgInfo);
1419 damageInfo->absorb = dmgInfo.GetAbsorb();
1420 damageInfo->resist = dmgInfo.GetResist();
1421 damageInfo->damage = dmgInfo.GetDamage();
1422 }
1423}
@ SPELLMOD_CRIT_DAMAGE_BONUS
Definition: SpellDefines.h:92
@ SPELL_DIRECT_DAMAGE
Definition: Unit.h:249
@ SPELL_DAMAGE_CLASS_RANGED
Definition: SharedDefines.h:1548
@ SPELL_DAMAGE_CLASS_MAGIC
Definition: SharedDefines.h:1546
@ SPELL_DAMAGE_CLASS_NONE
Definition: SharedDefines.h:1545
@ SPELL_DAMAGE_CLASS_MELEE
Definition: SharedDefines.h:1547
@ SPELL_HIT_TYPE_CRIT
Definition: SharedDefines.h:1536
virtual void OnCalculateSpellDamageReceived(int32 &, Unit *)
Definition: UnitAI.h:382
Unit * target
Definition: Unit.h:495
uint32 HitInfo
Definition: Unit.h:506
uint32 damage
Definition: Unit.h:498
uint32 absorb
Definition: Unit.h:501
Unit * attacker
Definition: Unit.h:496
uint32 schoolMask
Definition: Unit.h:500
uint32 cleanDamage
Definition: Unit.h:508
uint32 resist
Definition: Unit.h:502
uint32 blocked
Definition: Unit.h:505
bool isSpellBlocked(Unit *victim, SpellInfo const *spellProto, WeaponAttackType attackType=BASE_ATTACK)
Definition: Unit.cpp:3067
static uint32 SpellCriticalDamageBonus(Unit const *caster, SpellInfo const *spellProto, uint32 damage, Unit const *victim)
Definition: Unit.cpp:12216

References SpellNonMeleeDamage::absorb, AddPct(), ApplyResilience(), SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CalcAbsorbResist(), CalcArmorReducedDamage(), CanApplyResilience(), SpellNonMeleeDamage::cleanDamage, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, SpellNonMeleeDamage::damage, SpellInfo::DmgClass, DamageInfo::GetAbsorb(), GetAI(), GetCreatureTypeMask(), DamageInfo::GetDamage(), DamageInfo::GetResist(), SpellInfo::GetSchoolMask(), GetShieldBlockValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, IsAlive(), isBlockCritical(), IsDamageReducedByArmor(), isSpellBlocked(), UnitAI::OnCalculateSpellDamageReceived(), RANGED_ATTACK, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_DIRECT_DAMAGE, SPELL_HIT_TYPE_CRIT, SPELL_SCHOOL_MASK_NORMAL, SpellCriticalDamageBonus(), SPELLMOD_CRIT_DAMAGE_BONUS, sScriptMgr, and SpellNonMeleeDamage::target.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ CanApplyResilience()

◆ CanDualWield()

◆ CanEnterWater()

virtual bool Unit::CanEnterWater ( ) const
pure virtual

Implemented in Creature, and Player.

◆ CanFly()

◆ CanFreeMove()

bool Unit::CanFreeMove ( ) const
inline
743 {
746 }
@ UNIT_STATE_DISTRACTED
Definition: UnitDefines.h:161
@ UNIT_STATE_CONFUSED
Definition: UnitDefines.h:160
@ UNIT_STATE_FLEEING
Definition: UnitDefines.h:156
@ UNIT_STATE_IN_FLIGHT
Definition: UnitDefines.h:157
@ UNIT_STATE_STUNNED
Definition: UnitDefines.h:152

References GetOwnerGUID(), HasUnitState(), UNIT_STATE_CONFUSED, UNIT_STATE_DISTRACTED, UNIT_STATE_FLEEING, UNIT_STATE_IN_FLIGHT, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by SpellInfo::CheckTarget(), and Creature::IsFreeToMove().

◆ CanHaveThreatList()

bool Unit::CanHaveThreatList ( ) const
14542{
14543 // only creatures can have threat list
14544 if (GetTypeId() != TYPEID_UNIT)
14545 return false;
14546
14547 // only alive units can have threat list
14548 if (!IsAlive() || isDying())
14549 return false;
14550
14551 // totems can not have threat list
14552 if (ToCreature()->IsTotem())
14553 return false;
14554
14555 // vehicles can not have threat list
14556 if (ToCreature()->IsVehicle() && GetMap()->IsBattlegroundOrArena())
14557 return false;
14558
14559 // summons can not have a threat list, unless they are controlled by a creature
14561 return false;
14562
14563 return true;
14564}
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition: UnitDefines.h:143
@ UNIT_MASK_GUARDIAN
Definition: UnitDefines.h:137
Map * GetMap() const
Definition: Object.h:529
bool IsVehicle() const
Definition: Unit.h:757
bool isDying() const
Definition: Unit.h:1152

References WorldObject::GetMap(), GetOwnerGUID(), Object::GetTypeId(), HasUnitTypeMask(), IsAlive(), isDying(), Object::IsPlayer(), IsTotem(), IsVehicle(), Object::ToCreature(), TYPEID_UNIT, UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_MASK_GUARDIAN, and UNIT_MASK_MINION.

Referenced by AddThreat(), Creature::CanPeriodicallyCallForAssistance(), ThreatMgr::ClearAllThreat(), DealDamage(), ScriptedAI::DoResetThreatList(), CreatureAI::DoZoneInCombat(), Spell::EffectTaunt(), Spell::EffectThreat(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleModTaunt(), Spell::HandleThreatSpells(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), Creature::SelectVictim(), TauntApply(), TauntFadeOut(), and Update().

◆ CanInstantCast()

bool Unit::CanInstantCast ( ) const
inline
1780{ return _instantCast; }

References _instantCast.

Referenced by ModSpellCastTime().

◆ CanModifyStats()

◆ CanProc()

bool Unit::CanProc ( )
inline
1663{return !m_procDeep;}

References m_procDeep.

Referenced by Spell::DoAllEffectOnTarget().

◆ CanRestoreMana()

bool Unit::CanRestoreMana ( SpellInfo const *  spellInfo) const
21120{
21121 // Aura of Despair exceptions
21122 switch (spellInfo->Id)
21123 {
21124 case 16666: // Demonic Rune
21125 case 27869: // Dark Rune
21126 case 30824: // Shamanistic Rage
21127 case 31786: // Spiritual Attunement
21128 case 31930: // Judgements of the Wise
21129 case 34075: // Aspect of the Viper
21130 case 34720: // Thrill of the hunt
21131 case 47755: // Rapture
21132 case 54425: // Improved Felhunter
21133 case 57319: // Blessing of Sanctuary
21134 case 63337: // Saronite Vapors (regenerate mana)
21135 case 63375: // Improved stormstrike
21136 case 64372: // Lifebloom
21137 case 68285: // Improved Leader of the Pack
21138 return true;
21139 case 54428: // Divine Plea - only with talent Guarded by the Light
21140 return HasSpell(53583);
21141 default:
21142 break;
21143 }
21144
21145 return false;
21146}
virtual bool HasSpell(uint32) const
Definition: Unit.h:1046

References HasSpell(), and SpellInfo::Id.

Referenced by IsImmunedToSpellEffect().

◆ CanSwim()

bool Unit::CanSwim ( ) const
virtual

this method checks the current flag of a unit

These flags can be set within the database or dynamically changed at runtime UNIT_FLAG_SWIMMING must be updated when a unit enters a swimmable area

Reimplemented in Creature.

19885{
19886 // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water
19888 return false;
19890 return true;
19892 return false;
19894 return true;
19896}
@ UNIT_FLAG2_UNUSED_6
Definition: UnitDefines.h:286
@ UNIT_FLAG_CANNOT_SWIM
Definition: UnitDefines.h:243
@ UNIT_FLAG_POSSESSED
Definition: UnitDefines.h:253
@ UNIT_FLAG_SWIMMING
Definition: UnitDefines.h:244
@ UNIT_FLAG_RENAME
Definition: UnitDefines.h:233
@ UNIT_FLAG_PET_IN_COMBAT
Definition: UnitDefines.h:240
bool HasUnitFlag2(UnitFlags2 flags) const
Definition: Unit.h:831

References HasUnitFlag(), HasUnitFlag2(), UNIT_FLAG2_UNUSED_6, UNIT_FLAG_CANNOT_SWIM, UNIT_FLAG_PET_IN_COMBAT, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_FLAG_POSSESSED, UNIT_FLAG_RENAME, and UNIT_FLAG_SWIMMING.

Referenced by Creature::CanSwim().

◆ CanUseAttackType()

◆ CastCustomSpell() [1/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
CustomSpellValues const &  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1238{
1239 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1240 if (!spellInfo)
1241 {
1242 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1244 }
1245
1246 SpellCastTargets targets;
1247 targets.SetUnitTarget(victim);
1248
1249 return CastSpell(targets, spellInfo, &value, triggerFlags, castItem, triggeredByAura, originalCaster);
1250}
@ SPELL_FAILED_SPELL_UNAVAILABLE
Definition: SharedDefines.h:1056
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
Definition: Spell.h:109
void SetUnitTarget(Unit *target)
Definition: Spell.cpp:239

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetUnitTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastCustomSpell() [2/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1224{
1225 CustomSpellValues values;
1226 values.AddSpellMod(mod, value);
1227 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1228}
@ TRIGGERED_NONE
Definition: SpellDefines.h:131
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1211
Definition: SpellDefines.h:163
void AddSpellMod(SpellValueMod mod, int32 value)
Definition: SpellDefines.h:165

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastCustomSpell() [3/4]

SpellCastResult Unit::CastCustomSpell ( uint32  spellId,
SpellValueMod  mod,
int32  value,
Unit victim = nullptr,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1231{
1232 CustomSpellValues values;
1233 values.AddSpellMod(mod, value);
1234 return CastCustomSpell(spellId, values, target, triggerFlags, castItem, triggeredByAura, originalCaster);
1235}

References CustomSpellValues::AddSpellMod(), and CastCustomSpell().

◆ CastCustomSpell() [4/4]

SpellCastResult Unit::CastCustomSpell ( Unit victim,
uint32  spellId,
int32 const *  bp0,
int32 const *  bp1,
int32 const *  bp2,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1212{
1213 CustomSpellValues values;
1214 if (bp0)
1215 values.AddSpellMod(SPELLVALUE_BASE_POINT0, *bp0);
1216 if (bp1)
1217 values.AddSpellMod(SPELLVALUE_BASE_POINT1, *bp1);
1218 if (bp2)
1219 values.AddSpellMod(SPELLVALUE_BASE_POINT2, *bp2);
1220 return CastCustomSpell(spellId, values, target, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1221}
@ SPELLVALUE_BASE_POINT1
Definition: SpellDefines.h:115
@ SPELLVALUE_BASE_POINT2
Definition: SpellDefines.h:116
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:114

References CustomSpellValues::AddSpellMod(), CastCustomSpell(), SPELLVALUE_BASE_POINT0, SPELLVALUE_BASE_POINT1, SPELLVALUE_BASE_POINT2, TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

Referenced by spell_pri_guardian_spirit::Absorb(), spell_mage_fire_frost_ward::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_the_lich_king_necrotic_plague_jump_aura::AfterDispel(), spell_dru_lifebloom::AfterRemove(), Player::ApplyEnchantment(), Player::ApplyEquipSpell(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), npc_gas_cloud::npc_gas_cloudAI::CastMainSpell(), CastPetAura(), spell_ruby_sanctum_rallying_shout::CountAllies(), spell_igb_rocket_artillery_explosion::DamageGunship(), boss_illidari_council_memberAI::DamageTaken(), boss_leotheras_the_blind::DemonTime(), spell_warl_seed_of_corruption_generic_aura::Detonate(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), Spell::EffectDestroyAllTotems(), Spell::EffectDispel(), Spell::EffectFeedPet(), Spell::EffectForceCast(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonType(), EnterVehicle(), EnterVehicleUnattackable(), AuraMunchingQueue::Execute(), TriggerWickedSpirit::Execute(), spell_sha_totem_of_wrath::HandleAfterCast(), spell_reflective_shield_aura::HandleAfterEffectAbsorb(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraProc(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_pri_shadow_word_death::HandleDamage(), spell_dk_corpse_explosion::HandleDamage(), spell_dru_lifebloom::HandleDispel(), spell_igb_burning_pitch::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_deathbringer_blood_link::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_gen_dummy_trigger::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_pal_divine_storm_dummy::HandleDummy(), spell_sha_ancestral_awakening_proc::HandleDummy(), spell_sha_cleansing_totem_pulse::HandleDummy(), spell_warl_life_tap::HandleDummy(), spell_warr_last_stand::HandleDummy(), spell_warr_charge::HandleDummy(), spell_warr_slam::HandleDummy(), spell_warr_bloodthirst::HandleDummy(), HandleDummyAuraProc(), spell_egg_explosion::HandleDummyHitTarget(), spell_warr_execute::HandleEffect(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_serpentshrine_cavern_infection::HandleEffectRemove(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_ragin_flames_inferno::HandlePeriodic(), spell_dk_death_and_decay_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_deathbringer_blood_link_aura::HandleProc(), spell_deathbringer_blood_link_blood_beast_aura::HandleProc(), spell_reliquary_of_souls_aura_of_desire_aura::HandleProc(), spell_black_temple_consuming_strikes_aura::HandleProc(), spell_item_blade_ward_enchant::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), spell_dru_living_seed_proc::HandleProc(), spell_hun_ascpect_of_the_viper::HandleProc(), spell_sha_earth_shield::HandleProc(), spell_the_lich_king_dark_hunger_aura::HandleProc(), spell_yogg_saron_grim_reprisal_aura::HandleProc(), spell_dk_wandering_plague_aura::HandleProc(), spell_dk_blood_gorged::HandleProc(), spell_dru_living_seed::HandleProc(), spell_gen_blade_warding::HandleProc(), spell_hun_glyph_of_arcane_shot::HandleProc(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_item_necrotic_touch::HandleProc(), spell_mage_burnout::HandleProc(), spell_pal_seal_of_command_aura::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pal_seal_of_righteousness::HandleProc(), spell_pri_divine_aegis::HandleProc(), spell_pri_glyph_of_prayer_of_healing::HandleProc(), spell_rog_blade_flurry::HandleProc(), spell_sha_item_mana_surge::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleProcTriggerSpellWithValueAuraProc(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_igb_rocket_pack_aura::HandleRemove(), spell_warl_haunt_aura::HandleRemove(), spell_pal_lay_on_hands::HandleScript(), spell_kelthuzad_detonate_mana_aura::HandleScript(), spell_q12919_gymers_grab::HandleScript(), spell_gluth_decimate::HandleScriptEffect(), spell_hun_chimera_shot::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), spell_illidari_council_circle_of_healing::HandleSharedRule(), HandleSpellClick(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), spell_halion_damage_aoe_summon::HandleSummon(), spell_putricide_mutated_transformation::HandleSummon(), spell_putricide_mutated_plague_aura::HandleTriggerSpell(), boss_essence_of_suffering::boss_essence_of_sufferingAI::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::JustEngagedWith(), boss_mother_shahraz::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_najentus::JustEngagedWith(), boss_morogrim_tidewalker::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), spell_dru_tiger_s_fury::OnHit(), spell_gen_flurry_of_claws::OnPeriodic(), spell_blood_queen_essence_of_the_blood_queen_aura::OnProc(), spell_pal_eye_for_an_eye::OnProc(), spell_warl_siphon_life::OnProc(), spell_warl_fel_synergy::OnProc(), spell_warr_improved_spell_reflection::OnProc(), spell_warr_damage_shield::OnProc(), spell_kalecgos_curse_of_boundless_agony_aura::OnRemove(), spell_halion_marks_aura::OnRemove(), spell_putricide_mutated_plague_aura::OnRemove(), spell_the_lich_king_necrotic_plague_aura::OnRemove(), spell_yogg_saron_malady_of_the_mind_aura::OnRemove(), spell_sindragosa_instability_aura::OnRemove(), spell_the_lich_king_necrotic_plague_jump_aura::OnRemove(), spell_karazhan_overload_aura::PeriodicTick(), spell_doomfire::PeriodicTick(), spell_blood_queen_pact_of_the_darkfallen_dmg_aura::PeriodicTick(), spell_broggok_poison_cloud::PeriodicTick(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11198_take_down_tethyr::PrepareSpellScript(), spell_illidari_council_reflective_shield_aura::ReflectDamage(), spell_pri_power_word_shield_aura::ReflectDamage(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), boss_magtheridon::ScheduleCombatEvents(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), boss_viscidus::SummonedCreatureDies(), spell_dk_anti_magic_shell_self::Trigger(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), spell_the_lich_king_life_siphon::TriggerHeal(), spell_pal_divine_storm::TriggerHeal(), spell_black_temple_shadow_inferno_aura::Update(), spell_black_temple_spell_absorption_aura::Update(), boss_felblood_kaelthas::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), boss_huhuran::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_living_constellation::npc_living_constellationAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), and boss_toravon::boss_toravonAI::UpdateAI().

◆ CastDelayedSpellWithPeriodicAmount()

void Unit::CastDelayedSpellWithPeriodicAmount ( Unit caster,
uint32  spellId,
AuraType  auraType,
int32  addAmount,
uint8  effectIndex = 0 
)
20211{
20212 for (AuraEffectList::iterator i = m_modAuras[auraType].begin(); i != m_modAuras[auraType].end(); ++i)
20213 {
20214 AuraEffect* aurEff = *i;
20215 if (aurEff->GetCasterGUID() != caster->GetGUID() || aurEff->GetId() != spellId || aurEff->GetEffIndex() != effectIndex || !aurEff->GetTotalTicks())
20216 continue;
20217
20218 addAmount += ((aurEff->GetOldAmount() * std::max<int32>(aurEff->GetTotalTicks() - int32(aurEff->GetTickNumber()), 0)) / aurEff->GetTotalTicks());
20219 break;
20220 }
20221
20222 // xinef: delay only for casting on different unit
20223 if (this == caster || !sWorld->getBoolConfig(CONFIG_MUNCHING_BLIZZLIKE))
20224 caster->CastCustomSpell(spellId, SPELLVALUE_BASE_POINT0, addAmount, this, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, caster->GetGUID());
20225 else
20226 caster->m_Events.AddEvent(new AuraMunchingQueue(*caster, GetGUID(), addAmount, spellId), caster->m_Events.CalculateQueueTime(400));
20227}
TriggerCastFlags
Definition: SpellDefines.h:130
@ TRIGGERED_NO_PERIODIC_RESET
Will ignore equipped item requirements.
Definition: SpellDefines.h:150
@ CONFIG_MUNCHING_BLIZZLIKE
Definition: IWorld.h:189
uint64 CalculateQueueTime(uint64 delay) const
Definition: EventProcessor.cpp:164
Definition: Unit.cpp:20190
uint32 GetTickNumber() const
Definition: SpellAuraEffects.h:87
int32 GetOldAmount() const
Definition: SpellAuraEffects.h:116
uint32 GetId() const
Definition: SpellAuraEffects.cpp:432
int32 GetTotalTicks() const
Definition: SpellAuraEffects.cpp:7365
ObjectGuid GetCasterGUID() const
Definition: SpellAuraEffects.h:48

References EventProcessor::AddEvent(), EventProcessor::CalculateQueueTime(), CastCustomSpell(), CONFIG_MUNCHING_BLIZZLIKE, AuraEffect::GetCasterGUID(), AuraEffect::GetEffIndex(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetOldAmount(), AuraEffect::GetTickNumber(), AuraEffect::GetTotalTicks(), m_Events, m_modAuras, SPELLVALUE_BASE_POINT0, sWorld, TRIGGERED_FULL_MASK, and TRIGGERED_NO_PERIODIC_RESET.

Referenced by HandleDummyAuraProc(), spell_mage_ignite::HandleProc(), spell_dru_t10_balance_4p_bonus::HandleProc(), spell_sha_t10_restoration_4p_bonus::HandleProc(), spell_sha_t8_electrified::HandleProc(), and HandleProcTriggerSpell().

◆ CastPetAura()

void Unit::CastPetAura ( PetAura const *  aura)
17239{
17240 uint32 auraId = aura->GetAura(GetEntry());
17241 if (!auraId)
17242 return;
17243
17244 if (auraId == 35696) // Demonic Knowledge
17245 {
17246 int32 basePoints = aura->GetDamage();
17247 CastCustomSpell(this, auraId, &basePoints, nullptr, nullptr, true);
17248 }
17249 else
17250 CastSpell(this, auraId, true);
17251}

References CastCustomSpell(), CastSpell(), PetAura::GetAura(), PetAura::GetDamage(), and Object::GetEntry().

Referenced by Pet::CastPetAuras().

◆ CastSpell() [1/7]

SpellCastResult Unit::CastSpell ( float  x,
float  y,
float  z,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1253{
1254 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1255 if (!spellInfo)
1256 {
1257 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1259 }
1260
1261 SpellCastTargets targets;
1262 targets.SetDst(x, y, z, GetOrientation());
1263
1264 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1265}
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition: Spell.cpp:406

References CastSpell(), Object::GetGUID(), Position::GetOrientation(), LOG_ERROR, SpellCastTargets::SetDst(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [2/7]

SpellCastResult Unit::CastSpell ( GameObject go,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1268{
1269 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1270 if (!spellInfo)
1271 {
1272 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1274 }
1275
1276 SpellCastTargets targets;
1277 targets.SetGOTarget(go);
1278
1279 return CastSpell(targets, spellInfo, nullptr, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1280}
void SetGOTarget(GameObject *target)
Definition: Spell.cpp:271

References CastSpell(), Object::GetGUID(), LOG_ERROR, SpellCastTargets::SetGOTarget(), SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, Position::ToString(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [3/7]

SpellCastResult Unit::CastSpell ( SpellCastTargets const &  targets,
SpellInfo const *  spellInfo,
CustomSpellValues const *  value,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
Todo:
: this is a workaround - not needed anymore, but required for some scripts :(
1155{
1156 if (!spellInfo)
1157 {
1158 LOG_ERROR("entities.unit", "CastSpell: unknown spell by caster {}", GetGUID().ToString());
1160 }
1161
1163 if (!originalCaster && triggeredByAura)
1164 {
1165 originalCaster = triggeredByAura->GetCasterGUID();
1166 }
1167
1168 Spell* spell = new Spell(this, spellInfo, triggerFlags, originalCaster);
1169
1170 if (value)
1171 {
1172 for (CustomSpellValues::const_iterator itr = value->begin(); itr != value->end(); ++itr)
1173 {
1174 spell->SetSpellValue(itr->first, itr->second);
1175 }
1176 }
1177
1178 spell->m_CastItem = castItem;
1179 return spell->prepare(&targets, triggeredByAura);
1180}
void SetSpellValue(SpellValueMod mod, int32 value)
Definition: Spell.cpp:8422
Item * m_CastItem
Definition: Spell.h:521

References AuraEffect::GetCasterGUID(), Object::GetGUID(), LOG_ERROR, Spell::m_CastItem, Spell::prepare(), Spell::SetSpellValue(), SPELL_FAILED_SPELL_UNAVAILABLE, and Position::ToString().

Referenced by Player::_addSpell(), Player::_addTalentAurasAndSpells(), Spell::_cast(), _ExitVehicle(), Player::_LoadGlyphAuras(), Battleground::_ProcessResurrect(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_rog_cheat_death::Absorb(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), Player::ActivateSpec(), spell_halion_combustion_consumption_aura::AddMarkStack(), Battleground::AddPlayer(), Arena::AddPlayer(), BattlegroundIC::AddPlayer(), BattlegroundMap::AddPlayerToMap(), Battleground::AddPlayerToResurrectQueue(), Pet::addSpell(), spell_dru_barkskin::AfterApply(), spell_dru_savage_roar_aura::AfterApply(), spell_astromancer_wrath_of_the_astromancer::AfterRemove(), spell_gen_lifebloom::AfterRemove(), spell_oculus_stop_time_aura::Apply(), spell_sha_earthbind_totem::Apply(), spell_warl_health_funnel::ApplyEffect(), Player::ApplyEnchantment(), spell_hun_lock_and_load::ApplyMarker(), npc_mograine::npc_mograineAI::AshbringerEvent(), npc_ritual_channeler::npc_ritual_channelerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), boss_grand_champion::boss_grand_championAI::boss_grand_championAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::boss_yoggsaron_crusher_tentacleAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::boss_yoggsaron_death_orbAI(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::boss_yoggsaron_influence_tentacleAI(), Player::BuildPlayerRepop(), spell_igb_incinerating_blast::CalculateDamage(), spell_igb_cannon_blast::CalculatePower(), npc_echo_of_medivh::CastChangeFacing(), npc_chesspiece::CastChangeFacing(), CastCustomSpell(), npc_hallows_end_soh::CastFires(), Player::CastItemCombatSpell(), npc_volatile_ooze::npc_volatile_oozeAI::CastMainSpell(), CastPetAura(), boss_mor_grayhoof::CastRandomSpell(), GameObject::CastSpell(), CastSpell(), spell_the_lich_king_defile::ChangeDamageAndGrow(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), spell_eredar_twins_handle_touch::CheckCast(), Spell::CheckItems(), spell_botanica_shift_form_aura::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), spell_the_lich_king_shadow_trap_periodic::CheckTargetCount(), spell_dk_raise_dead::ConsumeReagents(), spell_frost_giant_death_plague::CountTargets(), instance_blackrock_spire::instance_blackrock_spireMapScript::CreatureLooted(), violet_hold_trashAI::CreatureStartAttackDoor(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), npc_collapsing_star::npc_collapsing_starAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), DealDamage(), DealMeleeDamage(), spell_warl_seed_of_corruption_aura::Detonate(), spell_warl_seed_of_corruption_generic_aura::Detonate(), boss_twin_valkyrAI::DoAction(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_icc_severed_essence::npc_icc_severed_essenceAI::DoAction(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), npc_eris_hevenfire::npc_eris_hevenfireAI::DoAction(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_flame_leviathan::boss_flame_leviathanAI::DoAction(), boss_magtheridon::DoAction(), boss_sacrolash::boss_sacrolashAI::DoAction(), boss_alythess::boss_alythessAI::DoAction(), boss_kalecgos::boss_kalecgosAI::DoAction(), boss_sathrovarr::boss_sathrovarrAI::DoAction(), npc_kalecgos_kj::npc_kalecgos_kjAI::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_black_knight::boss_black_knightAI::DoAction(), boss_jormungarAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_icc_blood_beast::npc_icc_blood_beastAI::DoAction(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_molten_golem::npc_molten_golemAI::DoAction(), boss_steelbreaker::boss_steelbreakerAI::DoAction(), npc_ulduar_bot_summon_trigger::npc_ulduar_bot_summon_triggerAI::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DoAction(), boss_yoggsaron_keeper::DoAction(), boss_illidari_council::DoAction(), boss_illidari_council_memberAI::DoAction(), Spell::DoAllEffectOnTarget(), UnitAI::DoCast(), UnitAI::DoCastAOE(), ScriptedAI::DoCastSpell(), InstanceScript::DoCastSpellOnPlayer(), InstanceScript::DoCastSpellOnPlayers(), UnitAI::DoCastToAllHostilePlayers(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), npc_midsummer_ribbon_pole_target::DoFireworkChecks(), npc_midsummer_ribbon_pole_target::DoGroundFlowerChecks(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), npc_midsummer_ribbon_pole_target::DoSpewLavaChecks(), boss_skeram::DoTeleport(), Spell::DoTriggersOnSpellHit(), Player::DuelComplete(), Spell::EffectActivateRune(), Spell::EffectApplyGlyph(), Spell::EffectCastButtons(), Spell::EffectDummy(), Spell::EffectEnergize(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectInebriate(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectStuck(), Spell::EffectSummonType(), Spell::EffectTaunt(), Spell::EffectTeleportUnits(), Spell::EffectTitanGrip(), Spell::EffectTriggerMissileSpell(), Spell::EffectTriggerRitualOfSummoning(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::EmpowerCultist(), boss_the_lich_king::boss_the_lich_kingAI::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), BattlegroundEY::EventTeamCapturedPoint(), BattleExperienceEvent::Execute(), OrcDeathEvent::Execute(), CastArmageddon::Execute(), UtherBatteredHiltEvent::Execute(), ShockVortexExplodeEvent::Execute(), ResetEncounterEvent::Execute(), FrostBombExplosion::Execute(), IceTombSummonEvent::Execute(), VileSpiritActivateEvent::Execute(), LichKingMovieEvent::Execute(), DelayedCastEvent::Execute(), DelayedCastMincharEvent::Execute(), ChargeRifts::Execute(), CosmicSmashDamageEvent::Execute(), CastRunesEvent::Execute(), BoomEvent::Execute(), SACActivateEvent::Execute(), VerasEnvenom::Execute(), CastQuill::Execute(), lapseTeleport::Execute(), boss_salramm::boss_salrammAI::ExplodeGhoul(), spell_festergut_blighted_spores_aura::ExtraEffect(), spell_rotface_mutated_infection_aura::ExtraRemoveEffect(), npc_dark_iron_attack_generator::FinishAttackDueToWin(), npc_azure_saboteur::npc_azure_saboteurAI::FinishPointReached(), boss_janalai::boss_janalaiAI::FireWall(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::GoSiphon(), go_soulwell::go_soulwellAI::GossipHello(), spell_cataclysm_breath::HandleAfterCast(), spell_dk_chains_of_ice::HandleAfterCast(), spell_mage_arcane_blast::HandleAfterCast(), spell_q13086_last_line_of_defence::HandleAfterCast(), spell_infected_worgen_bite_aura::HandleAfterEffectApply(), spell_dk_blood_boil::HandleAfterHit(), spell_dk_scourge_strike::HandleAfterHit(), spell_rog_deadly_poison::HandleAfterHit(), spell_warlords_rage::HandleAfterRemove(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), spell_felmyst_fog_of_corruption_charm_aura::HandleApply(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleApply(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), spell_dru_enrage::HandleApply(), spell_rog_killing_spree_aura::HandleApply(), spell_warr_vigilance::HandleApply(), spell_azjol_nerub_pound::HandleApplyAura(), BattlegroundIC::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModShapeshift(), HandleAuraProc(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_dk_death_grip::HandleBaseDummy(), misc_commandscript::HandleBindSightCommand(), spell_rotface_unstable_ooze_explosion_init::HandleCast(), spell_commander_sarannis_summon_reinforcements::HandleCast(), cast_commandscript::HandleCastBackCommand(), cast_commandscript::HandleCastCommand(), cast_commandscript::HandleCastDestCommand(), cast_commandscript::HandleCastDistCommand(), cast_commandscript::HandleCastSelfCommand(), cast_commandscript::HandleCastTargetCommad(), spell_gen_mounted_charge::HandleChargeEffect(), spell_dk_corpse_explosion::HandleCorpseExplosion(), OutdoorPvPSI::HandleCustomSpell(), WorldSession::HandleDuelCancelledOpcode(), spell_icc_shattered_bones::HandleDummy(), spell_corrupted_totems::HandleDummy(), spell_moroes_vanish::HandleDummy(), spell_karazhan_blink::HandleDummy(), spell_ooze_zap::HandleDummy(), spell_saviana_conflagration_init::HandleDummy(), spell_igb_burning_pitch_selector::HandleDummy(), spell_igb_burning_pitch::HandleDummy(), spell_charge_shield_bomber::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_anti_air_rocket_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_illidan_found_target::HandleDummy(), spell_leotheras_chaos_blast::HandleDummy(), spell_morogrim_tidewalker_watery_grave::HandleDummy(), spell_q10935_the_exorcism_of_colonel_jules::HandleDummy(), spell_gen_focused_bursts::HandleDummy(), spell_shadowblink::HandleDummy(), spell_spawn_drakonid::HandleDummy(), spell_send_mug_target_picker::HandleDummy(), spell_hallows_end_candy::HandleDummy(), spell_hallows_end_bucket_lands::HandleDummy(), spell_midsummer_torch_catch::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_mana_burn_area::HandleDummy(), spell_voljin_war_drums::HandleDummy(), spell_voodoo::HandleDummy(), spell_sartharion_lava_strike::HandleDummy(), spell_halion_meteor_strike_targeting::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_drakkari_colossus_emerge::HandleDummy(), spell_drakkari_colossus_surge::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_voa_flaming_cinder::spell_voa_flaming_cinder_SpellScript::HandleDummy(), spell_q12096_q12092_dummy::HandleDummy(), spell_vehicle_warhead_fuse::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_najentus_needle_spine::HandleDummy(), spell_ice_spear_target_picker::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), spell_gen_cannibalize::HandleDummy(), spell_gen_gadgetzan_transporter_backfire::HandleDummy(), spell_gen_gnomish_transporter::HandleDummy(), spell_hun_masters_call::HandleDummy(), spell_hun_pet_carrion_feeder::HandleDummy(), spell_item_gnomish_universal_remote::HandleDummy(), spell_item_gnomish_shrink_ray::HandleDummy(), spell_item_trigger_spell::HandleDummy(), spell_item_deviate_fish::HandleDummy(), spell_item_flask_of_the_north::HandleDummy(), spell_item_make_a_wish::HandleDummy(), spell_item_mingos_fortune_generator::HandleDummy(), spell_item_net_o_matic::HandleDummy(), spell_item_noggenfogger_elixir::HandleDummy(), spell_item_savory_deviate_delight::HandleDummy(), spell_item_six_demon_bag::HandleDummy(), spell_item_underbelly_elixir::HandleDummy(), spell_item_vanquished_clutches::HandleDummy(), spell_item_purify_helboar_meat::HandleDummy(), spell_item_reindeer_transformation::HandleDummy(), spell_item_nigh_invulnerability::HandleDummy(), spell_item_poultryizer::HandleDummy(), spell_item_socrethars_stone::HandleDummy(), spell_item_demon_broiled_surprise::HandleDummy(), spell_item_complete_raptor_capture::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), spell_item_nitro_boots::HandleDummy(), spell_item_teach_language::HandleDummy(), spell_item_rocket_boots::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_item_greatmothers_soulcatcher::HandleDummy(), spell_mage_summon_water_elemental::HandleDummy(), spell_pal_blessing_of_faith::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pal_judgement_of_command::HandleDummy(), spell_pri_penance::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_q5206_test_fetid_skull::HandleDummy(), spell_q11396_11399_scourging_crystal_controller::HandleDummy(), spell_q11587_arcane_prisoner_rescue::HandleDummy(), spell_q11730_ultrasonic_screwdriver::HandleDummy(), spell_q12634_despawn_fruit_tosser::HandleDummy(), spell_q12683_take_sputum_sample::HandleDummy(), spell_q12937_relief_for_the_fallen::HandleDummy(), spell_q9452_cast_net::HandleDummy(), spell_q13291_q13292_q13239_q13261_frostbrood_skytalon_grab_decoy::HandleDummy(), spell_q12308_escape_from_silverbrook::HandleDummy(), spell_q12641_death_comes_from_on_high::HandleDummy(), spell_rog_shiv::HandleDummy(), spell_sha_fire_nova::HandleDummy(), spell_warl_ritual_of_doom_effect::HandleDummy(), spell_warl_soulshatter::HandleDummy(), spell_warr_charge::HandleDummy(), spell_magtheridon_shadow_grasp::HandleDummyApply(), HandleDummyAuraProc(), spell_yogg_saron_destabilization_matrix::HandleDummyEffect(), spell_yogg_saron_insane_periodic_trigger::HandleDummyEffect(), spell_image_of_drakuru_reagent_check::HandleDummyEffect(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_talon_king_ikiss_blink::HandleDummyHitTarget(), spell_shadowfang_keep_forsaken_skills::spell_shadowfang_keep_forsaken_skills_AuraScript::HandleDummyTick(), spell_item_rocket_chicken::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_shadowfang_keep_haunting_spirits::spell_shadowfang_keep_haunting_spirits_AuraScript::HandleDummyTick(), spell_blood_council_shadow_prison_aura::HandleDummyTick(), spell_mark_of_nature::HandleEffect(), spell_target_fissures::HandleEffect(), spell_rog_vanish::HandleEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_midsummer_ribbon_pole::HandleEffectApply(), spell_tharon_ja_dummy_aura::HandleEffectApply(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectApply(), spell_teron_gorefiend_shadowy_construct::HandleEffectApply(), spell_leotheras_insidious_whisper_aura::HandleEffectApply(), spell_serpentshrine_cavern_coilfang_water::HandleEffectApply(), spell_q12851_going_bearback::HandleEffectApply(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_gen_whisper_gulch_yogg_saron_whisper::HandleEffectPeriodic(), spell_rog_killing_spree_aura::HandleEffectPeriodic(), spell_sha_earthbind_totem::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_warr_retaliation::HandleEffectProc(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_aura::HandleEffectRemove(), spell_illidan_parasitic_shadowfiend_trigger_aura::HandleEffectRemove(), spell_teron_gorefiend_shadow_of_death::HandleEffectRemove(), spell_black_temple_skeleton_shot_aura::HandleEffectRemove(), spell_hydross_cleansing_field_command::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite::HandleEffectRemove(), spell_serpentshrine_cavern_serpentshrine_parasite_trigger_aura::HandleEffectRemove(), spell_q10930_big_bone_worm_aura::HandleEffectRemove(), spell_q10929_fumping_aura::HandleEffectRemove(), spell_flamewreath::HandleFinish(), spell_midsummer_fling_torch::HandleFinish(), spell_midsummer_juggling_torch::HandleFinish(), spell_wintergrasp_rp_gg::HandleFinish(), spell_dreamwalker_summoner::HandleForceCast(), spell_dreamwalker_summon_suppresser_effect::HandleForceCast(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), OPvPCapturePointZM_GraveYard::HandleGossipOption(), spell_item_crazy_alchemists_potion::HandleHeal(), spell_magtheridon_quake::HandleHit(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), OutdoorPvPHP::HandleKillImpl(), OutdoorPvPNA::HandleKillImpl(), OutdoorPvPZM::HandleKillImpl(), BattlegroundIC::HandleKillUnit(), WorldSession::HandleMoveSplineDoneOpcode(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_ticking_time_bomb_aura::HandleOnEffectRemove(), spell_delusions_of_jindo::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), spell_mark_of_frost_freeze::HandleOnHit(), spell_mutate_explode_bug::HandleOnHit(), spell_explode_trigger::HandleOnHit(), spell_blade_dance_targeting::HandleOnHit(), HandleOverrideClassScriptAuraProc(), aura_class_call_wild_magic::HandlePeriodic(), spell_shadow_sickle_periodic_damage::HandlePeriodic(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_halion_meteor_strike_spread_aura::HandlePeriodic(), spell_sladran_grip_of_sladran_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_close_rift_aura::HandlePeriodic(), spell_serpentshrine_cavern_coilfang_water::HandlePeriodic(), spell_rancid_spore_cloud::HandlePeriodic(), spell_kaelthas_remote_toy::HandlePeriodic(), spell_q10923_evil_draws_near_periodic_aura::HandlePeriodic(), spell_sha_totemic_mastery::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_kiljaeden_shadow_spike_aura::HandlePeriodic(), spell_kiljaeden_armageddon_periodic_aura::HandlePeriodic(), spell_halion_twilight_cutter_periodic_aura::HandlePeriodic(), spell_oculus_ride_ruby_emerald_amber_drake_que_aura::HandlePeriodic(), spell_hun_sniper_training::HandlePeriodic(), spell_shadow_bolt_whirl::HandlePeriodic(), spell_voa_overcharge::spell_voa_overcharge_AuraScript::HandlePeriodicDummy(), AuraEffect::HandlePeriodicDummyAuraTick(), spell_magtheridon_shadow_grasp::HandlePeriodicRemove(), spell_igb_periodic_trigger_with_power_cost_aura::HandlePeriodicTick(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), spell_bronjahm_soulstorm_channel_ooc_aura::HandlePeriodicTick(), spell_bronjahm_soulstorm_visual_aura::HandlePeriodicTick(), spell_item_direbrew_remote_aura::HandlePeriodicTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceMoveByAI(), OutdoorPvPEP::HandlePlayerEnterZone(), OutdoorPvPHP::HandlePlayerEnterZone(), OutdoorPvPNA::HandlePlayerEnterZone(), OutdoorPvPSI::HandlePlayerEnterZone(), OutdoorPvPTF::HandlePlayerEnterZone(), OutdoorPvPZM::HandlePlayerEnterZone(), WorldSession::HandlePlayerLoginFromDB(), BattlegroundIC::HandlePlayerResurrect(), misc_commandscript::HandlePossessCommand(), spell_blood_queen_vampiric_bite::HandlePresence(), spell_mark_of_malice::HandleProc(), spell_item_lil_phylactery::HandleProc(), spell_item_fate_rune_of_unsurpassed_vigor::HandleProc(), spell_mage_burning_determination::HandleProc(), spell_rog_tricks_of_the_trade::HandleProc(), spell_gyth_chromatic_protection::HandleProc(), spell_ahune_spanky_hands::HandleProc(), spell_item_trauma::HandleProc(), spell_item_shadows_fate::HandleProc(), spell_utgarde_pinnacle_beast_mark::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_hun_improved_mend_pet::HandleProc(), spell_hun_misdirection::HandleProc(), spell_item_aegis_of_preservation::HandleProc(), spell_item_desperate_defense::HandleProc(), spell_mage_focus_magic::HandleProc(), spell_pal_blessing_of_sanctuary::HandleProc(), spell_pri_item_greater_heal_refund::HandleProc(), spell_pri_mana_leech::HandleProc(), spell_sha_item_lightning_shield_trigger::HandleProc(), spell_warr_vigilance::HandleProc(), spell_karazhan_temptation::HandleProc(), spell_dk_blood_caked_blade::HandleProc(), spell_dk_dancing_rune_weapon::HandleProc(), spell_gen_adaptive_warding::HandleProc(), spell_gen_moss_covered_feet::HandleProc(), spell_item_unsated_craving::HandleProc(), spell_item_shadowmourne::HandleProc(), spell_sha_item_lightning_shield::HandleProc(), spell_warl_glyph_of_shadowflame::HandleProc(), spell_warr_sweeping_strikes::HandleProc(), spell_hun_lock_and_load::HandleProcs(), HandleProcTriggerSpell(), AuraEffect::HandleProcTriggerSpellAuraProc(), WorldSession::HandleQuestgiverAcceptQuestOpcode(), AuraEffect::HandleRaidProcFromChargeAuraProc(), spell_dk_raise_dead::HandleRaiseDead(), spell_vael_burning_adrenaline::HandleRemove(), spell_kiljaeden_darkness_aura::HandleRemove(), spell_entropius_void_zone_visual_aura::HandleRemove(), spell_igb_rocket_pack_aura::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_gen_mine_sweeper::HandleSchoolDMG(), spell_warl_shadowflame::HandleSchoolDMG(), spell_gen_bandage::HandleScript(), spell_pal_lay_on_hands::HandleScript(), spell_kormok_summon_bone_mages::HandleScript(), spell_kormok_summon_bone_minions::HandleScript(), spell_energize_aoe::HandleScript(), spell_saviana_conflagration_throwback::HandleScript(), spell_taldaram_glittering_sparks::HandleScript(), spell_blood_queen_bloodbolt::HandleScript(), spell_blood_queen_presence_of_the_darkfallen::HandleScript(), spell_igb_rocket_artillery::HandleScript(), spell_putricide_unstable_experiment::HandleScript(), spell_sindragosa_icy_grip::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_summon_spirit_bomb::HandleScript(), spell_dreamwalker_summon_portal::HandleScript(), spell_dreamwalker_twisted_nightmares::HandleScript(), spell_archavon_rock_shards::spell_archavon_rock_shards_SpellScript::HandleScript(), spell_wintergrasp_portal::HandleScript(), spell_gen_create_lance::HandleScript(), spell_item_defibrillate::HandleScript(), spell_item_scroll_of_recall::HandleScript(), spell_shazzrah_gate_dummy::HandleScript(), spell_apothecary_lingering_fumes::HandleScript(), spell_apothecary_validate_area::HandleScript(), spell_apothecary_throw_cologne::HandleScript(), spell_apothecary_throw_perfume::HandleScript(), spell_hallows_end_trick::HandleScript(), spell_hallows_end_put_costume::HandleScript(), spell_hallows_end_trick_or_treat::HandleScript(), spell_winter_veil_mistletoe::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_moam_summon_mana_fiends::HandleScript(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), spell_mistress_kiss_area::spell_mistress_kiss_area_SpellScript::HandleScript(), spell_novos_summon_minions::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_choking_gas_bomb::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_the_lich_king_cast_back_to_caster::HandleScript(), spell_frost_giant_death_plague::HandleScript(), spell_yogg_saron_target_selectors::HandleScript(), spell_the_black_stalker_levitate::HandleScript(), spell_the_black_stalker_levitation_pulse::HandleScript(), spell_the_black_stalker_someone_grab_me::HandleScript(), spell_the_black_stalker_magnetic_pull::HandleScript(), spell_the_flag_of_ownership::HandleScript(), spell_gen_elune_candle::HandleScript(), spell_gen_teleporting::HandleScript(), spell_gen_dalaran_disguise::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_item_dimensional_ripper_area52::HandleScript(), spell_item_eggnog::HandleScript(), spell_q12735_song_of_cleansing::HandleScript(), spell_q13011_bear_flank_master::HandleScript(), spell_q12619_emblazon_runeblade_effect::HandleScript(), spell_q12919_gymers_grab::HandleScript(), spell_q12919_gymers_throw::HandleScript(), spell_q12641_death_comes_from_on_high_summon_ghouls::spell_q12641_death_comes_from_on_high_summon_ghouls_SpellScript::HandleScriptEffect(), spell_kalecgos_spectral_realm_dummy::HandleScriptEffect(), spell_entropius_negative_energy::HandleScriptEffect(), spell_marrowgar_coldflame_bonestorm::HandleScriptEffect(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_black_temple_bloodbolt::HandleScriptEffect(), spell_lady_vashj_summon_sporebat::HandleScriptEffect(), spell_kaelthas_summon_weapons::HandleScriptEffect(), spell_kaelthas_gravity_lapse::HandleScriptEffect(), spell_kaelthas_nether_beam::HandleScriptEffect(), spell_gen_clone::HandleScriptEffect(), spell_gen_clone_weapon::HandleScriptEffect(), spell_gen_break_shield::HandleScriptEffect(), spell_gen_mounted_charge::HandleScriptEffect(), spell_gen_throw_shield::HandleScriptEffect(), spell_item_sleepy_willy::HandleScriptEffect(), spell_item_lil_xt::HandleScriptEffect(), spell_q12698_the_gift_that_keeps_on_giving::spell_q12698_the_gift_that_keeps_on_giving_SpellScript::HandleScriptEffect(), spell_death_knight_initiate_visual::HandleScriptEffect(), spell_q12779_an_end_to_all_things::HandleScriptEffect(), spell_brewfest_toss_mug::HandleScriptEffect(), spell_direbrew_summon_mole_machine_target_picker::HandleScriptEffect(), spell_request_second_mug::HandleScriptEffect(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), spell_dtk_summon_random_drakkari::HandleScriptEffect(), spell_marrowgar_coldflame::HandleScriptEffect(), spell_arcane_chains_character_force_cast::HandleScriptEffect(), spell_q12611_deathbolt::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), spell_black_temple_summon_shadowfiends::HandleScriptEffect(), spell_ice_bombardment_dest_picker::HandleScriptEffect(), spell_kaelthas_remove_enchanted_weapons::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_hun_masters_call::HandleScriptEffect(), spell_item_mirrens_drinking_hat::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), spell_q1846_bending_shinbone::HandleScriptEffect(), spell_q14112_14145_chum_the_water::HandleScriptEffect(), WorldSession::HandleSelfResOpcode(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), HandleSpellClick(), spell_marrowgar_bone_spike_graveyard::HandleSpikes(), AuraEffect::HandleSpiritOfRedemption(), spell_gen_paralytic_poison::HandleStun(), spell_putricide_mutated_transformation::HandleSummon(), spell_item_draenic_pale_ale::HandleSummon(), WorldSession::HandleTalentWipeConfirmOpcode(), spell_mother_shahraz_fatal_attraction::HandleTeleportUnits(), spell_warl_drain_soul::HandleTick(), WorldSession::HandleTrainerBuySpellOpcode(), spell_trigger_spell_from_caster::HandleTrigger(), spell_magic_eater_food::HandleTriggerSpell(), spell_winter_veil_racer_rocket_slam::HandleTriggerSpell(), spell_pal_righteous_defense::HandleTriggerSpellHit(), boss_onyxia::HandleWhelpSpam(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), boss_ichoron::boss_ichoronAI::IchoronDoCastToAllHostilePlayers(), spell_q10769_dissension_amongst_the_ranks_aura::if(), CharmInfo::InitCharmCreateSpells(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InitFight(), boss_urok_doomhowl::boss_urok_doomhowlAI::InitializeAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::InitializeAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::InitializeAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::InitializeAI(), boss_gal_darah::boss_gal_darahAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), CharmInfo::InitPossessCreateSpells(), Guardian::InitStatsForLevel(), Totem::InitSummon(), boss_faction_championsAI::IsCCed(), npc_living_inferno::npc_living_infernoAI::IsSummonedBy(), TriggerAI::IsSummonedBy(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_bone_spike::npc_bone_spikeAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_pet_gen_fetch_ball::IsSummonedBy(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::JustDied(), npc_hallows_end_soh::JustDied(), boss_rajaxx::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), npc_swarm_scarab::npc_swarm_scarabAI::JustDied(), npc_phantom_hallucination::npc_phantom_hallucinationAI::JustDied(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::JustDied(), boss_steelbreaker::boss_steelbreakerAI::JustDied(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustDied(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustDied(), boss_freya_summons::boss_freya_summonsAI::JustDied(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::JustDied(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::JustDied(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::JustDied(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::JustDied(), npc_ichor_globule::npc_ichor_globuleAI::JustDied(), boss_fathomguard_sharkkis::JustDied(), boss_fathomguard_tidalvess::JustDied(), boss_fathomguard_caribdis::JustDied(), CombatAI::JustDied(), npc_high_inquisitor_valroth::npc_high_inquisitor_valrothAI::JustDied(), boss_brutallus::boss_brutallusAI::JustDied(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), boss_sapphiron::boss_sapphironAI::JustDied(), boss_anomalus::boss_anomalusAI::JustDied(), npc_nerubar_victim::npc_nerubar_victimAI::JustDied(), boss_shade_of_akama::JustDied(), CasterAI::JustEngagedWith(), boss_servant_quarters::JustEngagedWith(), npc_mograine::npc_mograineAI::JustEngagedWith(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::JustEngagedWith(), npc_hallows_end_soh::JustEngagedWith(), boss_eadric::boss_eadricAI::JustEngagedWith(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustEngagedWith(), boss_twin_valkyrAI::JustEngagedWith(), boss_garfrost::boss_garfrostAI::JustEngagedWith(), npc_stinky_icc::npc_stinky_iccAI::JustEngagedWith(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), npc_rimefang::npc_rimefangAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), boss_freya_summons::boss_freya_summonsAI::JustEngagedWith(), boss_vezax::boss_vezaxAI::JustEngagedWith(), boss_hodir::boss_hodirAI::JustEngagedWith(), boss_thorim::boss_thorimAI::JustEngagedWith(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::JustEngagedWith(), boss_koralon::boss_koralonAI::JustEngagedWith(), boss_toravon::boss_toravonAI::JustEngagedWith(), boss_ichoron::boss_ichoronAI::JustEngagedWith(), boss_moragg::boss_moraggAI::JustEngagedWith(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::JustEngagedWith(), boss_watchkeeper_gargolmar::JustEngagedWith(), boss_gatewatcher_gyrokill::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), boss_sartharion::boss_sartharionAI::JustEngagedWith(), CombatAI::JustEngagedWith(), boss_ellris_duskhallow::JustEngagedWith(), boss_warlord_salaris::JustEngagedWith(), boss_garaxxas::JustEngagedWith(), boss_muru::boss_muruAI::JustEngagedWith(), boss_yauj::JustEngagedWith(), boss_novos::boss_novosAI::JustEngagedWith(), boss_moorabi::boss_moorabiAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), boss_sapphiron::boss_sapphironAI::JustEngagedWith(), boss_keristrasza::boss_keristraszaAI::JustEngagedWith(), boss_steelbreaker::boss_steelbreakerAI::JustEngagedWith(), boss_teron_gorefiend::JustEngagedWith(), boss_fathomlord_karathress::JustEngagedWith(), boss_fathomguard_sharkkis::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustReachedHome(), boss_bronjahm::boss_bronjahmAI::JustReachedHome(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustReachedHome(), boss_gal_darah::boss_gal_darahAI::JustReachedHome(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::JustReachedHome(), boss_freya::boss_freyaAI::JustSummoned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_skeram::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_ragnaros::boss_ragnarosAI::JustSummoned(), boss_vexallus::JustSummoned(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), npc_kalecgos_kj::npc_kalecgos_kjAI::JustSummoned(), boss_jindo::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_taldaram::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_gal_darah::boss_gal_darahAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::JustSummoned(), boss_malygos::boss_malygosAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_svala::boss_svalaAI::JustSummoned(), boss_shirrak_the_dead_watcher::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), boss_grandmaster_vorpil::JustSummoned(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), boss_veras_darkshadow::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_supremus::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::JustSummoned(), boss_ayamiss::JustSummoned(), Kill(), boss_azuregos::boss_azuregosAI::KilledUnit(), boss_anubrekhan::boss_anubrekhanAI::KilledUnit(), boss_doomwalker::KilledUnit(), npc_dark_iron_guzzler::KilledUnit(), boss_steelbreaker::boss_steelbreakerAI::KilledUnit(), emerald_dragonAI::KilledUnit(), boss_emeriss::boss_emerissAI::KilledUnit(), boss_felblood_kaelthas::LapseAction(), spell_mandokir_charge::LaunchHit(), Player::learnQuestRewardedSpells(), spell_taldaram_summon_flame_ball::Load(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_brewfest_keg_thrower::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_love_in_air_snivel::MoveInLineOfSight(), boss_temporus::MoveInLineOfSight(), npc_medivh_bm::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_spirit_shade::npc_spirit_shadeAI::MovementInform(), boss_selin_fireheart::MovementInform(), npc_unworthy_initiate::npc_unworthy_initiateAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_eck::boss_eckAI::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::MovementInform(), boss_malygos::boss_malygosAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::MovementInform(), boss_headless_horseman::MovementInform(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::MovementInform(), npc_ashtongue_sorcerer::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), boss_kagani_nightstrike::MovementInform(), npc_dark_iron_guzzler::MovementInform(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_assembly_lightning::npc_assembly_lightningAI::MovementInform(), boss_ymiron::boss_ymironAI::MovementInform(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), BattlegroundAB::NodeOccupied(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::npc_algalon_worm_holeAI(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_concentrated_ball::npc_concentrated_ballAI::npc_concentrated_ballAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_hol_monument::npc_hol_monumentAI::npc_hol_monumentAI(), npc_midsummer_torch_target::npc_midsummer_torch_target(), npc_power_spark::npc_power_sparkAI::npc_power_sparkAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::npc_ulduar_iron_constructAI(), npc_ulduar_toasty_fire::npc_ulduar_toasty_fireAI::npc_ulduar_toasty_fireAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), spell_shadowfang_keep_forsaken_skills::spell_shadowfang_keep_forsaken_skills_AuraScript::OnApply(), spell_direbrew_disarm::OnApply(), spell_love_is_in_the_air_romantic_picnic::OnApply(), spell_halion_combustion_consumption_aura::OnApply(), spell_load_into_catapult_aura::OnApply(), spell_gen_damage_reduction_aura::OnApply(), spell_gruul_ground_slam_trigger::OnApply(), spell_hun_ascpect_of_the_viper::OnApply(), spell_hun_viper_attack_speed::OnApply(), spell_item_with_mount_speed::OnApply(), spell_blood_queen_vampiric_bite::OnCast(), npc_chesspiece::OnCharmed(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_item_linken_boomerang::OnEffectLaunchTargetDisarm(), spell_item_linken_boomerang::OnEffectLaunchTargetStun(), npc_essence_of_twin::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), go_inconspicuous_mine_car::OnGossipHello(), go_manticron_cube::OnGossipHello(), go_noblegarden_colored_egg::OnGossipHello(), go_seer_of_zebhalak::OnGossipHello(), go_jump_a_tron::OnGossipHello(), go_orb_of_domination::OnGossipHello(), go_scourge_enclosure::OnGossipHello(), go_strange_pool::OnGossipHello(), go_simon_cluster::OnGossipHello(), go_tablet_of_the_seven::OnGossipHello(), go_arcane_prison::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), npc_steward_of_time::OnGossipSelect(), npc_iruk::OnGossipSelect(), npc_zephyr::OnGossipSelect(), npc_taxi::OnGossipSelect(), npc_locksmith::OnGossipSelect(), npc_engineering_tele_trinket::OnGossipSelect(), npc_sayge::OnGossipSelect(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_lokhtos_darkbargainer::OnGossipSelect(), boss_gloomrel::OnGossipSelect(), npc_death_knight_initiate::OnGossipSelect(), npc_parqual_fintallas::OnGossipSelect(), npcs_riverbreeze_and_silversky::OnGossipSelect(), npc_braug_dimspirit::OnGossipSelect(), npc_avatar_of_freya::OnGossipSelect(), npc_adventurous_dwarf::OnGossipSelect(), npc_wg_demolisher_engineer::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), npc_wormhole::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), go_amberpine_outhouse::OnGossipSelect(), go_fel_crystalforge::OnGossipSelect(), go_bashir_crystalforge::OnGossipSelect(), go_apexis_relic::OnGossipSelect(), Player::OnGossipSelect(), lfg::LFGPlayerScript::OnMapChanged(), spell_apothecary_perfume_spill::OnPeriodic(), spell_apothecary_cologne_spill::OnPeriodic(), spell_muru_summon_blood_elves_periodic_aura::OnPeriodic(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_anubisath_mortal_strike::OnPeriodic(), spell_the_lich_king_soul_reaper_aura::OnPeriodic(), spell_yogg_saron_brain_link_aura::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), spell_illidan_tear_of_azzinoth_summon_channel_aura::OnPeriodic(), spell_illidan_demon_transform1_aura::OnPeriodic(), spell_illidan_cage_trap_stun_aura::OnPeriodic(), spell_black_temple_dementia_aura::OnPeriodic(), spell_npc22275_crystal_prison_aura::OnPeriodic(), spell_item_eye_of_grillok_aura::OnPeriodic(), spell_muru_darkness_aura::OnPeriodic(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_the_lich_king_vile_spirits_aura::OnPeriodic(), spell_web_wrap_damage::OnPeriodic(), spell_assembly_rune_of_summoning_aura::OnPeriodic(), spell_thorim_lightning_pillar_P2_aura::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), spell_karathress_power_of_tidalvess::OnPeriodic(), spell_karathress_power_of_caribdis::OnPeriodic(), spell_leotheras_demon_link::OnPeriodic(), spell_lurker_below_spout::OnPeriodic(), spell_gen_periodic_knock_away::OnPeriodic(), spell_gen_turkey_marker::OnPeriodic(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnPlayerInWaterStateUpdate(), BattlefieldWG::OnPlayerJoinWar(), spell_gen_obsidian_armor::OnProc(), npc_steward_of_time::OnQuestAccept(), npc_mikhail::OnQuestAccept(), npc_rocknot::OnQuestReward(), npc_thrall_bfu::OnQuestReward(), spell_kalecgos_spectral_realm_aura::OnRemove(), spell_azgalor_doom_aura::OnRemove(), spell_boss_salramm_steal_flesh_aura::OnRemove(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_putricide_mutation_init_aura::OnRemove(), spell_the_lich_king_shadow_trap_visual_aura::OnRemove(), spell_the_lich_king_harvest_soul_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_ioc_repair_turret_aura::OnRemove(), spell_kaelthas_flame_strike::OnRemove(), spell_item_goblin_weather_machine_aura::OnRemove(), spell_warl_curse_of_doom::OnRemove(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), spell_item_shadowmourne_soul_fragment::OnStackChange(), at_hor_battered_hilt_throw::OnTrigger(), at_frozen_throne_teleport::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_stormwright_shelf::OnTrigger(), MidsummerPlayerScript::OnUpdateZone(), npc_wintergarde_gryphon::PassengerBoarded(), npc_four_car_garage::npc_four_car_garageAI::PassengerBoarded(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), spell_quest_test_flight_charging::PerformKick(), spell_send_mug_control_aura::PeriodicTick(), spell_barreled_control_aura::PeriodicTick(), spell_dreamwalker_summon_suppresser_aura::PeriodicTick(), spell_summon_ice_spear_delayer::PeriodicTick(), spell_summoning_rhyme_aura::PeriodicTick(), spell_halion_twilight_phasing::Phase(), Battlefield::PlayerAskToLeave(), BattlegroundAV::PopulateNode(), spell_azjol_nerub_carrion_beetels::PrepareAuraScript(), spell_item_oracle_ablutions::PrepareSpellScript(), spell_q11653_youre_not_so_big_now::PrepareSpellScript(), spell_q13369_fate_up_against_your_will::PrepareSpellScript(), SmartScript::ProcessAction(), ProcessCastaction(), Player::ProcessDelayedOperations(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::ProcessEvent(), ProcessTerrainStatusUpdate(), ProcessUnlearnAction(), BattlefieldWG::PromotePlayer(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), spell_gen_defend::RefreshVisualShields(), Vehicle::RemovePassenger(), spell_igb_below_zero::RemovePassengers(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), Player::ReportedAfkBy(), GuardAI::Reset(), boss_brutallus::boss_brutallusAI::Reset(), boss_sacrolash::boss_sacrolashAI::Reset(), boss_alythess::boss_alythessAI::Reset(), npc_demonic_vapor::npc_demonic_vaporAI::Reset(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::Reset(), boss_kalec::boss_kalecAI::Reset(), boss_sathrovarr::boss_sathrovarrAI::Reset(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::Reset(), npc_singularity::npc_singularityAI::Reset(), npc_batrider::Reset(), npc_dark_iron_guzzler::Reset(), boss_headless_horseman_pumpkin::Reset(), npc_taretha::npc_tarethaAI::Reset(), npc_medivh_bm::Reset(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_nerubian_burrower::npc_nerubian_burrowerAI::Reset(), boss_tharon_ja::boss_tharon_jaAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_elemental::boss_drakkari_elementalAI::Reset(), npc_dark_nucleus::npc_dark_nucleusAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_anomalus::boss_anomalusAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_bjarngrim::boss_bjarngrimAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_freya_lifebinder::boss_freya_lifebinderAI::Reset(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::Reset(), boss_freya_nature_bomb::boss_freya_nature_bombAI::Reset(), boss_thorim_lightning_orb::boss_thorim_lightning_orbAI::Reset(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::Reset(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::Reset(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_yoggsaron_voice::boss_yoggsaron_voiceAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_frozen_orb::npc_frozen_orbAI::Reset(), npc_frozen_orb_stalker::npc_frozen_orb_stalkerAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::Reset(), npc_storm_cloud::npc_storm_cloudAI::Reset(), boss_illidan_stormrage::boss_illidan_stormrageAI::Reset(), npc_ashtongue_channeler::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), boss_wrath_scryer_soccothrates::Reset(), npc_training_dummy::npc_training_dummyAI::Reset(), BfGraveyard::Resurrect(), Resurrect(), Player::ResurrectPlayer(), Player::RewardQuest(), boss_bjarngrim::boss_bjarngrimAI::RollStance(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), Map::ScriptsProcess(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::SelectT(), npc_sayge::SendAction(), go_skull_pile::SendActionMenu(), npc_xt002_heart::npc_xt002_heartAI::SendEnergyToCorner(), Player::SendInitialPacketsAfterAddToMap(), Player::SendQuestUpdate(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), npc_eastvale_peasent::SetData(), SetModelVisible(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), npc_stable_master::npc_stable_masterAI::sGossipSelect(), npc_brewfest_keg_reciver::sGossipSelect(), npc_cairne_bloodhoof::npc_cairne_bloodhoofAI::sGossipSelect(), npc_chesspiece::sGossipSelect(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::sGossipSelect(), npc_zafod_boombox::npc_zafod_boomboxAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), boss_hodir::boss_hodirAI::SmallIcicles(), boss_zuljin::boss_zuljinAI::SpawnAdds(), boss_skadi_grauf::boss_skadi_graufAI::SpawnFlameTriggers(), boss_malchezaar::SpawnInfernal(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), boss_eadric::boss_eadricAI::SpellHit(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_ichor_globule::npc_ichor_globuleAI::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_franklin::npc_franklinAI::SpellHit(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::SpellHit(), npc_dark_iron_guzzler::SpellHit(), boss_headless_horseman::SpellHit(), boss_thorim_pillar::boss_thorim_pillarAI::SpellHit(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_living_constellation::npc_living_constellationAI::SpellHit(), boss_ignis::boss_ignisAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_storm_cloud::npc_storm_cloudAI::SpellHit(), npc_soh_fire_trigger::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_midsummer_torch_target::SpellHit(), boss_magus_telestra::boss_magus_telestraAI::SpellHit(), boss_thorim::boss_thorimAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_bronjahm::boss_bronjahmAI::SpellHitTarget(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_rotface::boss_rotfaceAI::SpellHitTarget(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), boss_hodir::boss_hodirAI::SpellHitTarget(), npc_ulduar_rocket_strike_trigger::npc_ulduar_rocket_strike_triggerAI::SpellHitTarget(), npc_q24545_lich_king::npc_q24545_lich_kingAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), boss_epoch::boss_epochAI::SpellHitTarget(), boss_sapphiron::boss_sapphironAI::SpellHitTarget(), boss_skadi_grauf::boss_skadi_graufAI::SpellHitTarget(), boss_shirrak_the_dead_watcher::SpellHitTarget(), npc_pet_gen_soul_trader_beacon::SpellHitTarget(), Battleground::SpiritOfCompetitionEvent(), boss_ionar::boss_ionarAI::Split(), boss_heigan::boss_heiganAI::StartFightPhase(), npc_finklestein::npc_finklesteinAI::StartNextTask(), Player::StoreItem(), spell_dk_ghoul_explode::Suicide(), boss_anzu::SummonBroods(), boss_anubrekhan::boss_anubrekhanAI::SummonedCreatureDies(), boss_cthun::SummonedCreatureDies(), boss_vexallus::SummonedCreatureDies(), boss_paletress::boss_paletressAI::SummonMemory(), go_wind_stone::go_wind_stoneAI::SummonNPC(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), spell_igb_check_for_players::TeleportPlayer(), BattlegroundSA::TeleportToEntrancePosition(), spell_midsummer_fling_torch::ThrowNextTorch(), TriggerBurningPitch(), npc_orb_carrier::npc_orb_carrierAI::TriggerCutter(), spell_koralon_meteor_fists::spell_koralon_meteor_fists_AuraScript::TriggerFists(), spell_flame_warder_meteor_fists::spell_flame_warder_meteor_fists_AuraScript::TriggerFists(), spell_gen_holiday_buff_food::TriggerFoodBuff(), spell_karazhan_brittle_bones_aura::Update(), spell_black_temple_curse_of_the_bleakheart_aura::Update(), spell_illidari_council_deadly_strike_aura::Update(), spell_mother_shahraz_random_periodic_aura::Update(), spell_mother_shahraz_beam_periodic_aura::Update(), spell_mother_shahraz_saber_lash_aura::Update(), spell_black_temple_charge_rage_aura::Update(), Pet::Update(), GameObject::Update(), TotemAI::UpdateAI(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_image_of_medivh::npc_image_of_medivhAI::UpdateAI(), boss_felblood_kaelthas::UpdateAI(), boss_priestess_delrissa::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), boss_kagani_nightstrike::UpdateAI(), boss_ellris_duskhallow::UpdateAI(), boss_eramas_brightblaze::UpdateAI(), boss_yazzai::UpdateAI(), boss_warlord_salaris::UpdateAI(), boss_garaxxas::UpdateAI(), boss_apoko::UpdateAI(), boss_zelfan::UpdateAI(), boss_selin_fireheart::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_brutallus::boss_brutallusAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_sacrolash::boss_sacrolashAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), npc_demonic_vapor_trail::npc_demonic_vapor_trailAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_kalecgos_kj::npc_kalecgos_kjAI::UpdateAI(), boss_muru::boss_muruAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_fenstalker::boss_fenstalkerAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), npc_hallows_end_train_fire::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_headless_horseman_head::UpdateAI(), boss_headless_horseman_pumpkin::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), npc_time_rift::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_tharnarian::npc_tharnarianAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), npc_halion_controller::npc_halion_controllerAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_swarm_scarab::npc_swarm_scarabAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_druid::npc_toc_druidAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_paladin::npc_toc_paladinAI::UpdateAI(), npc_toc_priest::npc_toc_priestAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), npc_pos_icicle_trigger::npc_pos_icicle_triggerAI::UpdateAI(), npc_pos_collapsing_icicle::npc_pos_collapsing_icicleAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::UpdateAI(), boss_heigan::boss_heiganAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_naxxramas_misc::boss_naxxramas_miscAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), npc_alexstrasza::npc_alexstraszaAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_ormorok::boss_ormorokAI::UpdateAI(), npc_crystal_spike::npc_crystal_spikeAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir::boss_sjonnirAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::UpdateAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_freya_nature_bomb::boss_freya_nature_bombAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_saronite_animus::npc_ulduar_saronite_animusAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_ulduar_icicle::npc_ulduar_icicleAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_kologarn_eyebeam::boss_kologarn_eyebeamAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), npc_ulduar_proximity_mine::npc_ulduar_proximity_mineAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_watcher::npc_ulduar_dark_rune_watcherAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_thorim_trap::boss_thorim_trapAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_xt002_pummeller::npc_xt002_pummellerAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron_guardian_of_ys::boss_yoggsaron_guardian_of_ysAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_keleseth::boss_kelesethAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_thassarian::npc_thassarianAI::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_jungle_punch_target::npc_jungle_punch_targetAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_queue::npc_wg_queueAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_high_nethermancer_zerevor::UpdateAI(), boss_lady_malande::UpdateAI(), boss_veras_darkshadow::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_invis_infernal_caster::npc_invis_infernal_casterAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), trigger_periodic::trigger_periodicAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_maexxna_webwrap::boss_maexxna_webwrapAI::UpdateAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI(), npc_q24545_vegard_dummy::npc_q24545_vegard_dummyAI::UpdateAI(), Player::UpdateAreaDependentAuras(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdatePhase(), Player::UpdateZoneDependentAuras(), GameObject::Use(), Player::VehicleSpellInitialize(), boss_bjarngrim::boss_bjarngrimAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), and npc_engineer_helice::npc_engineer_heliceAI::WaypointReached().

◆ CastSpell() [4/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1200{
1201 return CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1202}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [5/7]

SpellCastResult Unit::CastSpell ( Unit victim,
SpellInfo const *  spellInfo,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1205{
1206 SpellCastTargets targets;
1207 targets.SetUnitTarget(victim);
1208 return CastSpell(targets, spellInfo, nullptr, triggerFlags, castItem, triggeredByAura, originalCaster);
1209}

References CastSpell(), and SpellCastTargets::SetUnitTarget().

◆ CastSpell() [6/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
bool  triggered,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1183{
1184 return CastSpell(victim, spellId, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
1185}

References CastSpell(), TRIGGERED_FULL_MASK, and TRIGGERED_NONE.

◆ CastSpell() [7/7]

SpellCastResult Unit::CastSpell ( Unit victim,
uint32  spellId,
TriggerCastFlags  triggerFlags = TRIGGERED_NONE,
Item castItem = nullptr,
AuraEffect const *  triggeredByAura = nullptr,
ObjectGuid  originalCaster = ObjectGuid::Empty 
)
1188{
1189 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1190 if (!spellInfo)
1191 {
1192 LOG_ERROR("entities.unit", "CastSpell: unknown spell {} by caster {}", spellId, GetGUID().ToString());
1194 }
1195
1196 return CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster);
1197}

References CastSpell(), Object::GetGUID(), LOG_ERROR, SPELL_FAILED_SPELL_UNAVAILABLE, sSpellMgr, and Position::ToString().

◆ CastStop()

◆ ChangeSeat()

void Unit::ChangeSeat ( int8  seatId,
bool  next = true 
)
19624{
19625 if (!m_vehicle)
19626 return;
19627
19628 if (seatId < 0)
19629 {
19630 seatId = m_vehicle->GetNextEmptySeat(GetTransSeat(), next);
19631 if (seatId < 0)
19632 return;
19633 }
19634 else if (seatId == GetTransSeat() || !m_vehicle->HasEmptySeat(seatId))
19635 return;
19636
19638 if (!m_vehicle->AddPassenger(this, seatId))
19639 ABORT();
19640}
int8 GetNextEmptySeat(int8 seatId, bool next) const
Definition: Vehicle.cpp:233
bool HasEmptySeat(int8 seatId) const
Definition: Vehicle.cpp:216

References ABORT, Vehicle::AddPassenger(), Vehicle::GetNextEmptySeat(), WorldObject::GetTransSeat(), Vehicle::HasEmptySeat(), m_vehicle, and Vehicle::RemovePassenger().

Referenced by _EnterVehicle(), and WorldSession::HandleChangeSeatsOnControlledVehicle().

◆ CleanupBeforeRemoveFromMap()

void Unit::CleanupBeforeRemoveFromMap ( bool  finalCleanup)
15670{
15672 return;
15673
15674 // This needs to be before RemoveFromWorld to make GetCaster() return a valid pointer on aura removal
15676
15677 if (IsInWorld()) // not in world and not being removed atm
15679
15680 ASSERT(GetGUID());
15681
15682 // A unit may be in removelist and not in world, but it is still in grid
15683 // and may have some references during delete
15686
15687 if (finalCleanup)
15688 m_cleanupDone = true;
15689
15690 m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted now but it will deleted at call in Map::RemoveAllObjectsInRemoveList
15691 CombatStop();
15696 GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
15697}
void KillAllEvents(bool force)
Definition: EventProcessor.cpp:82
void deleteReferences(bool removeFromMap=false)
Definition: HostileRefMgr.cpp:125
void ClearAllThreat()
Definition: ThreatMgr.cpp:417
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:10378
void RemoveAllGameObjects()
Definition: Unit.cpp:6214
void ClearComboPoints()
Definition: Unit.cpp:16792
void ClearComboPointHolders()
Definition: Unit.cpp:16847
HostileRefMgr & getHostileRefMgr()
Definition: Unit.h:1492
void RemoveFromWorld() override
Definition: Unit.cpp:15623
void RemoveAllAuras()
Definition: Unit.cpp:5270
ThreatMgr & GetThreatMgr()
Definition: Unit.h:1488
void Clear(bool reset=true)
Definition: MotionMaster.h:165

References ASSERT, MotionMaster::Clear(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearComboPoints(), CombatStop(), HostileRefMgr::deleteReferences(), Object::GetGUID(), getHostileRefMgr(), GetMotionMaster(), GetThreatMgr(), InterruptNonMeleeSpells(), IsDuringRemoveFromWorld(), Object::IsInWorld(), EventProcessor::KillAllEvents(), m_cleanupDone, m_Events, RemoveAllAuras(), RemoveAllGameObjects(), and RemoveFromWorld().

Referenced by CleanupsBeforeDelete().

◆ CleanupsBeforeDelete()

void Unit::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

15700{
15701 if (GetTransport())
15702 {
15704 SetTransport(nullptr);
15707 }
15708
15709 CleanupBeforeRemoveFromMap(finalCleanup);
15710}
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:331
void Reset()
Definition: Object.h:285
void SetTransport(Transport *t)
Definition: Object.h:605
virtual void RemovePassenger(WorldObject *passenger, bool withAll=false)=0
void CleanupBeforeRemoveFromMap(bool finalCleanup)
Definition: Unit.cpp:15669

References CleanupBeforeRemoveFromMap(), WorldObject::GetTransport(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), Transport::RemovePassenger(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), and MovementInfo::transport.

Referenced by Player::CleanupsBeforeDelete(), npc_commandscript::HandleNpcAddCommand(), and Map::RemoveAllObjectsInRemoveList().

◆ ClearAllReactives()

void Unit::ClearAllReactives ( )
16856{
16857 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
16858 m_reactiveTimer[i] = 0;
16859
16866}
@ CLASS_CONTEXT_ABILITY_REACTIVE
Definition: UnitDefines.h:214
@ CLASS_HUNTER
Definition: SharedDefines.h:143
@ CLASS_WARRIOR
Definition: SharedDefines.h:141
@ AURA_STATE_DEFENSE
Definition: SharedDefines.h:1292
@ AURA_STATE_HUNTER_PARRY
Definition: SharedDefines.h:1298
virtual bool IsClass(Classes unitClass, ClassContext context=CLASS_CONTEXT_NONE) const
Definition: Unit.h:766
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=nullptr, Unit const *Caster=nullptr) const
Definition: Unit.cpp:10487

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), Object::IsPlayer(), m_reactiveTimer, MAX_REACTIVE, and ModifyAuraState().

Referenced by Player::ActivateSpec(), npc_mograine::npc_mograineAI::DamageTaken(), and setDeathState().

◆ ClearComboPointHolders()

void Unit::ClearComboPointHolders ( )
16848{
16849 while (!m_ComboPointHolders.empty())
16850 {
16851 (*m_ComboPointHolders.begin())->ClearComboPoints(); // this also removes it from m_comboPointHolders
16852 }
16853}

References ClearComboPoints(), and m_ComboPointHolders.

Referenced by CreatureAI::_EnterEvadeMode(), CleanupBeforeRemoveFromMap(), npc_mograine::npc_mograineAI::DamageTaken(), Player::RemoveFromWorld(), and setDeathState().

◆ ClearComboPoints()

void Unit::ClearComboPoints ( )
16793{
16794 if (!m_comboTarget)
16795 {
16796 return;
16797 }
16798
16799 // remove Premed-like effects
16800 // (NB: this Aura retains the CP while it's active - now that CP have reset, it shouldn't be there anymore)
16802
16803 m_comboPoints = 0;
16806 m_comboTarget = nullptr;
16807}
@ SPELL_AURA_RETAIN_COMBO_POINTS
Definition: SpellAuraDefines.h:211

References m_comboPoints, m_comboTarget, RemoveAurasByType(), RemoveComboPointHolder(), SendComboPoints(), and SPELL_AURA_RETAIN_COMBO_POINTS.

Referenced by Spell::_handle_finish_phase(), CleanupBeforeRemoveFromMap(), ClearAllReactives(), ClearComboPointHolders(), Player::DuelComplete(), Player::RemoveFromWorld(), Player::setDeathState(), and UpdateReactives().

◆ ClearDiminishings()

void Unit::ClearDiminishings ( )
inline
672{ m_Diminishing.clear(); }

References m_Diminishing.

Referenced by setDeathState().

◆ ClearInCombat()

void Unit::ClearInCombat ( )
13739{
13740 m_CombatTimer = 0;
13742
13743 // Player's state will be cleared in Player::UpdateContestedPvP
13744 if (Creature* creature = ToCreature())
13745 {
13746 if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
13747 SetImmuneToPC(true); // set immunity state to the one from db on evade
13748
13751 ReplaceAllDynamicFlags(creature->GetCreatureTemplate()->dynamicflags);
13752
13753 creature->SetAssistanceTimer(0);
13754
13755 // Xinef: will be recalculated at follow movement generator initialization
13756 if (!IsPet() && !IsCharmed())
13757 return;
13758 }
13759 else if (Player* player = ToPlayer())
13760 {
13761 player->UpdatePotionCooldown();
13762 if (player->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
13763 for (uint8 i = 0; i < MAX_RUNES; ++i)
13764 player->SetGracePeriod(i, 0);
13765 }
13766
13767 if (Player* player = this->ToPlayer())
13768 {
13769 sScriptMgr->OnPlayerLeaveCombat(player);
13770 }
13771}
#define MAX_RUNES
Definition: Player.h:398
@ CLASS_CONTEXT_ABILITY
Definition: UnitDefines.h:213
@ UNIT_STATE_ATTACK_PLAYER
Definition: UnitDefines.h:163
@ UNIT_FLAG_IN_COMBAT
Definition: UnitDefines.h:248
@ UNIT_FLAG_IMMUNE_TO_PC
Definition: UnitDefines.h:237
@ CLASS_DEATH_KNIGHT
Definition: SharedDefines.h:146
void ReplaceAllDynamicFlags(uint32 flag) override
Definition: Unit.h:666
bool IsCharmed() const
Definition: Unit.h:1214
bool IsPet() const
Definition: Unit.h:754
void SetImmuneToPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13542
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:827

References CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, ClearUnitState(), Object::HasDynamicFlag(), IsCharmed(), IsPet(), m_CombatTimer, MAX_RUNES, RemoveUnitFlag(), ReplaceAllDynamicFlags(), SetImmuneToPC(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), UNIT_DYNFLAG_TAPPED, UNIT_FLAG_IMMUNE_TO_PC, UNIT_FLAG_IN_COMBAT, and UNIT_STATE_ATTACK_PLAYER.

Referenced by CombatStop(), Player::LoadFromDB(), and Update().

◆ ClearInPetCombat()

◆ ClearUnitState()

void Unit::ClearUnitState ( uint32  f)
inline
740{ m_state &= ~f; }

References m_state.

Referenced by Spell::_cast(), HomeMovementGenerator< Creature >::_setTargetLocation(), Attack(), FollowerAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), AttackStop(), ClearInCombat(), boss_thorim::boss_thorimAI::DisableThorim(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), HomeMovementGenerator< Creature >::DoFinalize(), WaypointMovementGenerator< Creature >::DoFinalize(), RandomMovementGenerator< T >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), RandomMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), Spell::EffectResurrectPet(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_ayamiss::EnterEvadeMode(), SmartAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), TimedFleeingMovementGenerator::Finalize(), RotateMovementGenerator::Finalize(), DistractMovementGenerator::Finalize(), AssistanceDistractMovementGenerator::Finalize(), Spell::finish(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraModSchoolImmunity(), debug_commandscript::HandleDebugUnitStateCommand(), AuraEffect::HandleFeignDeath(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), SmartAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), MotionMaster::MoveTargetedHome(), WaypointMovementGenerator< Creature >::OnArrived(), boss_nightbane::PathEndReached(), Creature::ReleaseFocus(), RemoveCharmedBy(), MotionTransport::RemovePassenger(), boss_ayamiss::Reset(), boss_hungarfen::Reset(), Player::ResetContestedPvP(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SetClientControl(), SetControlled(), Creature::setDeathState(), Player::setDeathState(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Player::SetIsSpectator(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), StopMoving(), StopMovingOnCurrentPos(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), and boss_the_lich_king::boss_the_lich_kingAI::UpdateAI().

◆ CombatStart()

void Unit::CombatStart ( Unit target,
bool  initialAggro = true 
)
13561{
13562 // Xinef: Dont allow to start combat with triggers
13563 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsTrigger())
13564 return;
13565
13566 if (initialAggro)
13567 {
13568 // Make player victim stand up automatically
13569 if (victim->getStandState() && victim->IsPlayer())
13570 {
13571 victim->SetStandState(UNIT_STAND_STATE_STAND);
13572 }
13573
13574 if (!victim->IsInCombat() && victim->GetTypeId() != TYPEID_PLAYER && !victim->ToCreature()->HasReactState(REACT_PASSIVE) && victim->ToCreature()->IsAIEnabled)
13575 {
13576 if (victim->IsPet())
13577 victim->ToCreature()->AI()->AttackedBy(this); // PetAI has special handler before AttackStart()
13578 else
13579 {
13580 victim->ToCreature()->AI()->AttackStart(this);
13581 // if the target is an NPC with a pet or minion, pet should react.
13582 if (Unit* victimControlledUnit = victim->GetFirstControlled())
13583 {
13584 victimControlledUnit->SetInCombatWith(this);
13585 SetInCombatWith(victimControlledUnit);
13586 victimControlledUnit->AddThreat(this, 0.0f);
13587 }
13588 }
13589
13590 // if unit has an owner, put owner in combat.
13591 if (Unit* victimOwner = victim->GetOwner())
13592 {
13593 if (!(victimOwner->IsInCombatWith(this)))
13594 {
13595 /* warding off to not take over aggro for no reason
13596 Using only AddThreat causes delay in attack */
13597 if (!victimOwner->IsInCombat() && victimOwner->IsAIEnabled)
13598 {
13599 victimOwner->ToCreature()->AI()->AttackStart(this);
13600 }
13601 victimOwner->SetInCombatWith(this);
13602 SetInCombatWith(victimOwner);
13603 victimOwner->AddThreat(this, 0.0f);
13604 }
13605 }
13606 }
13607
13608 bool alreadyInCombat = IsInCombat();
13609
13610 SetInCombatWith(victim);
13611 victim->SetInCombatWith(this);
13612
13613 // Xinef: If pet started combat - put owner in combat
13614 if (!alreadyInCombat && IsInCombat())
13615 {
13616 if (Unit* owner = GetOwner())
13617 {
13618 owner->SetInCombatWith(victim);
13619 victim->SetInCombatWith(owner);
13620 }
13621 }
13622 }
13623
13624 Unit* who = victim->GetCharmerOrOwnerOrSelf();
13625 if (who->IsPlayer())
13626 SetContestedPvP(who->ToPlayer());
13627
13629 if (player && who->IsPvP() && (who->GetTypeId() != TYPEID_PLAYER || !player->duel || player->duel->Opponent != who))
13630 {
13631 player->UpdatePvP(true);
13633 }
13634}
@ AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT
Definition: SpellDefines.h:67
@ REACT_PASSIVE
Definition: Unit.h:548
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:32
void UpdatePvP(bool state, bool _override=false)
Definition: PlayerUpdates.cpp:1480
Unit * GetCharmerOrOwnerOrSelf() const
Definition: Unit.h:1191
void SetContestedPvP(Player *attackedPlayer=nullptr, bool lookForNearContestedGuards=true)
Definition: Unit.cpp:17176
Unit * GetFirstControlled() const
Definition: Unit.cpp:11010
bool IsInCombat() const
Definition: Unit.h:1032

References Creature::AI(), CreatureAI::AttackedBy(), UnitAI::AttackStart(), AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetFirstControlled(), GetOwner(), getStandState(), Object::GetTypeId(), Creature::HasReactState(), IsAIEnabled, IsInCombat(), IsPet(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), REACT_PASSIVE, RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), SetStandState(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STAND_STATE_STAND, and Player::UpdatePvP().

Referenced by AttackerStateUpdate(), Spell::CheckCast(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectTaunt(), and AssistDelayEvent::Execute().

◆ CombatStartOnCast()

void Unit::CombatStartOnCast ( Unit target,
bool  initialAggro = true,
uint32  duration = 0 
)
13637{
13638 // Xinef: Dont allow to start combat with triggers
13639 if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsTrigger())
13640 return;
13641
13642 if (initialAggro)
13643 {
13644 SetInCombatWith(target, duration);
13645
13646 // Xinef: If pet started combat - put owner in combat
13647 if (Unit* owner = GetOwner())
13648 owner->SetInCombatWith(target, duration);
13649 }
13650
13651 Unit* who = target->GetCharmerOrOwnerOrSelf();
13652 if (who->IsPlayer())
13653 SetContestedPvP(who->ToPlayer());
13654
13656 if (player && who->IsPvP() && (who->GetTypeId() != TYPEID_PLAYER || !player->duel || player->duel->Opponent != who))
13657 {
13658 player->UpdatePvP(true);
13660 }
13661}
bool IsTrigger() const
Definition: Creature.h:78

References AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT, Player::duel, GetCharmerOrOwnerOrSelf(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetOwner(), Object::GetTypeId(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), RemoveAurasWithInterruptFlags(), SetContestedPvP(), SetInCombatWith(), Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and Player::UpdatePvP().

Referenced by Spell::_cast().

◆ CombatStop()

void Unit::CombatStop ( bool  includingCast = false)
10379{
10380 if (includingCast && IsNonMeleeSpellCast(false))
10382
10383 AttackStop();
10385 if (IsPlayer())
10386 ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
10387 ClearInCombat();
10388
10389 // xinef: just in case
10392}
void SendAttackSwingCancelAttack()
Definition: PlayerMisc.cpp:140
bool IsPetInCombat() const
Definition: Unit.h:1035
void ClearInPetCombat()
Definition: Unit.cpp:13773
void RemoveAllAttackers()
Remove all units in m_attackers list and send them AttackStop()
Definition: Unit.cpp:10424
void ClearInCombat()
Definition: Unit.cpp:13738
bool AttackStop()
Force the unit to stop attacking. This will clear UNIT_STATE_MELEE_ATTACKING, Interrupt current spell...
Definition: Unit.cpp:10345

References AttackStop(), ClearInCombat(), ClearInPetCombat(), Object::GetTypeId(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), IsPetInCombat(), Object::IsPlayer(), RemoveAllAttackers(), Player::SendAttackSwingCancelAttack(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by CreatureAI::_EnterEvadeMode(), PetAI::_stopAttack(), Player::ActivateTaxiPathTo(), CleanupBeforeRemoveFromMap(), CombatStopWithPets(), boss_felblood_kaelthas::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSanctuary(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), TotemAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleCombatStopCommand(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), npc_commandscript::HandleNpcDeleteCommand(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), npc_supremus_punch_invisible_stalker::IsSummonedBy(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), SmartScript::ProcessAction(), Player::RemovePet(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), setDeathState(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), Player::TeleportTo(), Totem::UnSummon(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ CombatStopWithPets()

void Unit::CombatStopWithPets ( bool  includingCast = false)
10395{
10396 CombatStop(includingCast);
10397
10398 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10399 (*itr)->CombatStop(includingCast);
10400}

References CombatStop(), and m_Controlled.

Referenced by DealDamage(), WorldSession::HandleDuelCancelledOpcode(), Player::SetGameMaster(), Player::SetGMVisible(), and Player::UpdateArea().

◆ CountPctFromCurHealth()

uint32 Unit::CountPctFromCurHealth ( int32  pct) const
inline
792{ return CalculatePct(GetHealth(), pct); }
uint32 GetHealth() const
Definition: Unit.h:782

References CalculatePct(), and GetHealth().

Referenced by spell_gen_leeching_swarm::spell_gen_leeching_swarm_AuraScript::HandleEffectPeriodic().

◆ CountPctFromMaxHealth()

uint32 Unit::CountPctFromMaxHealth ( int32  pct) const
inline
791{ return CalculatePct(GetMaxHealth(), pct); }
uint32 GetMaxHealth() const
Definition: Unit.h:783

References CalculatePct(), and GetMaxHealth().

Referenced by spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), spell_dru_survival_instincts_aura::AfterApply(), spell_dk_anti_magic_shell_self::CalculateAmount(), spell_dk_vampiric_blood::CalculateAmount(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::EffectHeal(), Spell::EffectHealPct(), Spell::EffectResurrect(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonType(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), spell_dk_death_strike::HandleDummy(), spell_hun_last_stand_pet::HandleDummy(), spell_warr_last_stand::HandleDummy(), HandleDummyAuraProc(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), HandleProcTriggerSpell(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), boss_harbinger_skyriss::JustSummoned(), boss_hadronox::boss_hadronoxAI::KilledUnit(), Pet::LoadPetFromDB(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_zuljin::boss_zuljinAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), and npc_injured_patient::npc_injured_patientAI::UpdateAI().

◆ CreateTamedPetFrom() [1/2]

Pet * Unit::CreateTamedPetFrom ( Creature creatureTarget,
uint32  spell_id = 0 
)
17269{
17270 if (GetTypeId() != TYPEID_PLAYER)
17271 return nullptr;
17272
17273 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
17274
17275 if (!pet->CreateBaseAtCreature(creatureTarget))
17276 {
17277 delete pet;
17278 return nullptr;
17279 }
17280
17281 uint8 level = creatureTarget->GetLevel() + 5 < GetLevel() ? (GetLevel() - 5) : creatureTarget->GetLevel();
17282
17283 if (!InitTamedPet(pet, level, spell_id))
17284 {
17285 delete pet;
17286 return nullptr;
17287 }
17288
17289 return pet;
17290}
@ HUNTER_PET
Definition: PetDefines.h:32
bool CreateBaseAtCreature(Creature *creature)
Definition: Pet.cpp:944
bool InitTamedPet(Pet *pet, uint8 level, uint32 spell_id)
Definition: Unit.cpp:17312

References Pet::CreateBaseAtCreature(), GetLevel(), Object::GetTypeId(), HUNTER_PET, InitTamedPet(), Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Player::CreatePet(), Spell::EffectCreateTamedPet(), and Spell::EffectTameCreature().

◆ CreateTamedPetFrom() [2/2]

Pet * Unit::CreateTamedPetFrom ( uint32  creatureEntry,
uint32  spell_id = 0 
)
17293{
17294 if (GetTypeId() != TYPEID_PLAYER)
17295 return nullptr;
17296
17297 CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry);
17298 if (!creatureInfo)
17299 return nullptr;
17300
17301 Pet* pet = new Pet(ToPlayer(), HUNTER_PET);
17302
17303 if (!pet->CreateBaseAtCreatureInfo(creatureInfo, this) || !InitTamedPet(pet, GetLevel(), spell_id))
17304 {
17305 delete pet;
17306 return nullptr;
17307 }
17308
17309 return pet;
17310}
#define sObjectMgr
Definition: ObjectMgr.h:1623
Definition: CreatureData.h:189
bool CreateBaseAtCreatureInfo(CreatureTemplate const *cinfo, Unit *owner)
Definition: Pet.cpp:979

References Pet::CreateBaseAtCreatureInfo(), GetLevel(), Object::GetTypeId(), HUNTER_PET, InitTamedPet(), sObjectMgr, Object::ToPlayer(), and TYPEID_PLAYER.

◆ CreateVehicleKit()

bool Unit::CreateVehicleKit ( uint32  id,
uint32  creatureEntry 
)
18633{
18634 VehicleEntry const* vehInfo = sVehicleStore.LookupEntry(id);
18635 if (!vehInfo)
18636 return false;
18637
18638 m_vehicleKit = new Vehicle(this, vehInfo, creatureEntry);
18641 return true;
18642}
DBCStorage< VehicleEntry > sVehicleStore(VehicleEntryfmt)
@ UPDATEFLAG_VEHICLE
Definition: UpdateData.h:46
@ UNIT_MASK_VEHICLE
Definition: UnitDefines.h:140

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, sVehicleStore, UNIT_MASK_VEHICLE, and UPDATEFLAG_VEHICLE.

Referenced by Creature::CreateFromProto(), AuraEffect::HandleAuraSetVehicle(), Mount(), and npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit().

◆ DealDamage()

uint32 Unit::DealDamage ( Unit attacker,
Unit victim,
uint32  damage,
CleanDamage const *  cleanDamage = nullptr,
DamageEffectType  damagetype = DIRECT_DAMAGE,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL,
SpellInfo const *  spellProto = nullptr,
bool  durabilityLoss = true,
bool  allowGM = false,
Spell const *  spell = nullptr 
)
static
798{
799 // Xinef: initialize damage done for rage calculations
800 // Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
801 uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
802
803 //if (attacker)
804 {
805 if (victim->IsAIEnabled)
806 victim->GetAI()->DamageTaken(attacker, damage, damagetype, damageSchoolMask);
807
808 if (attacker && attacker->IsAIEnabled)
809 attacker->GetAI()->DamageDealt(victim, damage, damagetype);
810 }
811
812 // Hook for OnDamage Event
813 sScriptMgr->OnDamage(attacker, victim, damage);
814
815 if (victim->IsPlayer() && attacker != victim)
816 {
817 // Signal to pets that their owner was attacked
818 Pet* pet = victim->ToPlayer()->GetPet();
819
820 if (pet && pet->IsAlive())
821 pet->AI()->OwnerAttackedBy(attacker);
822 }
823
824 //Dont deal damage to unit if .cheat god is enable.
825 if (victim->IsPlayer())
826 {
827 if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD))
828 {
829 return 0;
830 }
831 }
832
833 // Signal the pet it was attacked so the AI can respond if needed
834 if (victim->GetTypeId() == TYPEID_UNIT && attacker != victim && victim->IsPet() && victim->IsAlive())
835 victim->ToPet()->AI()->AttackedBy(attacker);
836
837 if (damagetype != NODAMAGE)
838 {
839 // interrupting auras with AURA_INTERRUPT_FLAG_DAMAGE before checking !damage (absorbed damage breaks that type of auras)
840 if (spellProto)
841 {
842 if (!spellProto->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
844 }
845 else
847
848 // interrupt spells with SPELL_INTERRUPT_FLAG_ABORT_ON_DMG on absorbed damage (no dots)
849 if (!damage && damagetype != DOT && cleanDamage && cleanDamage->absorbed_damage)
850 {
851 if (victim != attacker && victim->IsPlayer())
852 {
853 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
854 {
855 if (spell->getState() == SPELL_STATE_PREPARING)
856 {
857 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
858 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
859 {
860 victim->InterruptNonMeleeSpells(false);
861 }
862 }
863 }
864 }
865 }
866
867 // We're going to call functions which can modify content of the list during iteration over it's elements
868 // Let's copy the list so we can prevent iterator invalidation
870 // copy damage to casters of this aura
871 for (AuraEffectList::iterator i = vCopyDamageCopy.begin(); i != vCopyDamageCopy.end(); ++i)
872 {
873 // Check if aura was removed during iteration - we don't need to work on such auras
874 if (!((*i)->GetBase()->IsAppliedOnTarget(victim->GetGUID())))
875 continue;
876 // check damage school mask
877 if (((*i)->GetMiscValue() & damageSchoolMask) == 0)
878 continue;
879
880 Unit* shareDamageTarget = (*i)->GetCaster();
881 if (!shareDamageTarget)
882 continue;
883 SpellInfo const* spell = (*i)->GetSpellInfo();
884
885 uint32 shareDamage = CalculatePct(damage, (*i)->GetAmount());
886
887 uint32 shareAbsorb = 0;
888 uint32 shareResist = 0;
889
890 if (shareDamageTarget->IsImmunedToDamageOrSchool(damageSchoolMask))
891 {
892 shareAbsorb = shareDamage;
893 shareDamage = 0;
894 }
895 else
896 {
897 DamageInfo sharedDamageInfo(attacker, shareDamageTarget, shareDamage, spellProto, damageSchoolMask, damagetype);
898 Unit::CalcAbsorbResist(sharedDamageInfo, true);
899 shareAbsorb = sharedDamageInfo.GetAbsorb();
900 shareResist = sharedDamageInfo.GetResist();
901 shareDamage = sharedDamageInfo.GetDamage();
902 Unit::DealDamageMods(shareDamageTarget, shareDamage, &shareAbsorb);
903 }
904
905 if (attacker && shareDamageTarget->IsPlayer())
906 {
907 attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false, true);
908 }
909
910 Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false, false, damageSpell);
911 }
912 }
913
914 // Rage from Damage made (only from direct weapon damage)
915 if (attacker && cleanDamage && damagetype == DIRECT_DAMAGE && attacker != victim && attacker->HasActivePowerType(POWER_RAGE))
916 {
917 uint32 weaponSpeedHitFactor;
918
919 switch (cleanDamage->attackType)
920 {
921 case BASE_ATTACK:
922 case OFF_ATTACK:
923 {
924 weaponSpeedHitFactor = uint32(attacker->GetAttackTime(cleanDamage->attackType) / 1000.0f * (cleanDamage->attackType == BASE_ATTACK ? 3.5f : 1.75f));
925 if (cleanDamage->hitOutCome == MELEE_HIT_CRIT)
926 weaponSpeedHitFactor *= 2;
927
928 attacker->RewardRage(rage_damage, weaponSpeedHitFactor, true);
929 break;
930 }
931 case RANGED_ATTACK:
932 break;
933 default:
934 break;
935 }
936 }
937
938 if (!damage)
939 {
940 // Rage from absorbed damage
941 if (cleanDamage && cleanDamage->absorbed_damage)
942 {
943 if (victim->HasActivePowerType(POWER_RAGE))
944 victim->RewardRage(cleanDamage->absorbed_damage, 0, false);
945
946 if (attacker && attacker->HasActivePowerType(POWER_RAGE))
947 attacker->RewardRage(cleanDamage->absorbed_damage, 0, true);
948 }
949
950 return 0;
951 }
952
953 LOG_DEBUG("entities.unit", "DealDamageStart");
954
955 uint32 health = victim->GetHealth();
956 LOG_DEBUG("entities.unit", "deal dmg:{} to health:{} ", damage, health);
957
958 // duel ends when player has 1 or less hp
959 bool duel_hasEnded = false;
960 bool duel_wasMounted = false;
961 if (victim->IsPlayer() && victim->ToPlayer()->duel && damage >= (health - 1))
962 {
963 // xinef: situation not possible earlier, just return silently.
964 if (!attacker)
965 return 0;
966
967 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
968 if (victim->ToPlayer()->duel->Opponent == attacker || victim->ToPlayer()->duel->Opponent->GetGUID() == attacker->GetOwnerGUID())
969 damage = health - 1;
970
971 duel_hasEnded = true;
972 }
973 else if (victim->IsVehicle() && damage >= (health - 1) && victim->GetCharmer() && victim->GetCharmer()->IsPlayer())
974 {
975 Player* victimRider = victim->GetCharmer()->ToPlayer();
976
977 if (victimRider && victimRider->duel && victimRider->duel->IsMounted)
978 {
979 // xinef: situation not possible earlier, just return silently.
980 if (!attacker)
981 return 0;
982
983 // prevent kill only if killed in duel and killed by opponent or opponent controlled creature
984 if (victimRider->duel->Opponent == attacker || victimRider->duel->Opponent->GetGUID() == attacker->GetCharmerGUID())
985 damage = health - 1;
986
987 duel_wasMounted = true;
988 duel_hasEnded = true;
989 }
990 }
991
992 if (attacker && attacker != victim)
993 if (Player* killer = attacker->GetCharmerOrOwnerPlayerOrPlayerItself())
994 {
995 // pussywizard: don't allow GMs to deal damage in normal way (this leaves no evidence in logs!), they have commands to do so
996 //if (!allowGM && killer->GetSession()->GetSecurity() && killer->GetSession()->GetSecurity() <= SEC_ADMINISTRATOR)
997 // return 0;
998
999 if (Battleground* bg = killer->GetBattleground())
1000 {
1001 bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage);
1002 killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); // pussywizard: InBattleground() optimization
1003 }
1004 //killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_DEALT, damage); // pussywizard: optimization
1005 }
1006
1007 if (victim->IsPlayer())
1008 ;//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HIT_RECEIVED, damage); // pussywizard: optimization
1009 else if (!victim->IsControlledByPlayer() || victim->IsVehicle())
1010 {
1011 if (!victim->ToCreature()->hasLootRecipient())
1012 victim->ToCreature()->SetLootRecipient(attacker);
1013
1014 if (!attacker || attacker->IsControlledByPlayer() || attacker->IsCreatedByPlayer())
1015 {
1016 uint32 unDamage = health < damage ? health : damage;
1017 bool damagedByPlayer = unDamage && attacker && (attacker->IsPlayer() || attacker->m_movedByPlayer != nullptr);
1018 victim->ToCreature()->LowerPlayerDamageReq(unDamage, damagedByPlayer);
1019 }
1020 }
1021
1022 if (health <= damage)
1023 {
1024 LOG_DEBUG("entities.unit", "DealDamage: victim just died");
1025
1026 //if (attacker && victim->IsPlayer() && victim != attacker)
1027 //victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization
1028 Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell);
1029 }
1030 else
1031 {
1032 LOG_DEBUG("entities.unit", "DealDamageAlive");
1033
1034 //if (victim->IsPlayer())
1035 // victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, damage); // pussywizard: optimization
1036
1037 victim->ModifyHealth(- (int32)damage);
1038
1039 if (damagetype == DIRECT_DAMAGE || damagetype == SPELL_DIRECT_DAMAGE)
1040 victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
1041
1042 if (victim->GetTypeId() != TYPEID_PLAYER)
1043 {
1044 // Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
1045 if (damagetype != DOT && damage > 0 && !victim->GetOwnerGUID().IsPlayer() && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
1047
1048 if (attacker)
1049 {
1050 if (spellProto && victim->CanHaveThreatList() && !victim->HasUnitState(UNIT_STATE_EVADE) && !victim->IsInCombatWith(attacker))
1051 {
1052 victim->CombatStart(attacker, !(spellProto->AttributesEx3 & SPELL_ATTR3_SUPRESS_TARGET_PROCS));
1053 }
1054
1055 victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto);
1056 }
1057 }
1058 else // victim is a player
1059 {
1060 // random durability for items (HIT TAKEN)
1062 {
1065 }
1066 }
1067
1068 // Rage from damage received
1069 if (attacker != victim && victim->HasActivePowerType(POWER_RAGE))
1070 {
1071 uint32 rageDamage = damage + (cleanDamage ? cleanDamage->absorbed_damage : 0);
1072 victim->RewardRage(rageDamage, 0, false);
1073 }
1074
1075 if (attacker && attacker->IsPlayer())
1076 {
1077 // random durability for items (HIT DONE)
1079 {
1081 attacker->ToPlayer()->DurabilityPointLossForEquipSlot(slot);
1082 }
1083 }
1084
1085 if (damagetype != NODAMAGE && damage && (!spellProto || !(spellProto->HasAttribute(SPELL_ATTR3_TREAT_AS_PERIODIC) || spellProto->HasAttribute(SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK))))
1086 {
1087 if (victim != attacker && victim->IsPlayer()) // does not support creature push_back
1088 {
1089 if (damagetype != DOT && !(damageSpell && damageSpell->m_targets.HasDstChannel()))
1090 {
1091 if (Spell* spell = victim->m_currentSpells[CURRENT_GENERIC_SPELL])
1092 {
1093 if (spell->getState() == SPELL_STATE_PREPARING)
1094 {
1095 uint32 interruptFlags = spell->m_spellInfo->InterruptFlags;
1096 if (interruptFlags & SPELL_INTERRUPT_FLAG_ABORT_ON_DMG)
1097 {
1098 victim->InterruptNonMeleeSpells(false);
1099 }
1100 else if (interruptFlags & SPELL_INTERRUPT_FLAG_PUSH_BACK)
1101 {
1102 spell->Delayed();
1103 }
1104 }
1105 }
1106
1107 if (Spell* spell = victim->m_currentSpells[CURRENT_CHANNELED_SPELL])
1108 if (spell->getState() == SPELL_STATE_CASTING)
1109 {
1110 if ((spell->m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_DELAY) != 0)
1111 {
1112 spell->DelayedChannel();
1113 }
1114 }
1115 }
1116 }
1117 }
1118
1119 // last damage from duel opponent
1120 if (duel_hasEnded)
1121 {
1122 Player* he = duel_wasMounted ? victim->GetCharmer()->ToPlayer() : victim->ToPlayer();
1123
1124 ASSERT_NODEBUGINFO(he && he->duel);
1125
1126 if (duel_wasMounted) // In this case victim==mount
1127 victim->SetHealth(1);
1128 else
1129 he->SetHealth(1);
1130
1131 he->duel->Opponent->CombatStopWithPets(true);
1132 he->CombatStopWithPets(true);
1133
1134 he->CastSpell(he, 7267, true); // beg
1136 }
1137 }
1138
1139 LOG_DEBUG("entities.unit", "DealDamageEnd returned {} damage", damage);
1140
1141 return damage;
1142}
@ SPELL_STATE_PREPARING
Definition: Spell.h:224
@ SPELL_STATE_CASTING
Definition: Spell.h:225
@ CHANNEL_FLAG_DELAY
Definition: SpellDefines.h:39
@ AURA_INTERRUPT_FLAG_TAKE_DAMAGE
Definition: SpellDefines.h:45
@ AURA_INTERRUPT_FLAG_DIRECT_DAMAGE
Definition: SpellDefines.h:68
@ SPELL_INTERRUPT_FLAG_ABORT_ON_DMG
Definition: SpellDefines.h:31
@ SPELL_INTERRUPT_FLAG_PUSH_BACK
Definition: SpellDefines.h:28
@ SPELL_AURA_DAMAGE_SHIELD
Definition: SpellAuraDefines.h:78
@ SPELL_AURA_SHARE_DAMAGE_PCT
Definition: SpellAuraDefines.h:363
@ SCORE_DAMAGE_DONE
Definition: BattlegroundScore.h:33
#define MAX_AGGRO_RESET_TIME
Definition: CreatureData.h:29
@ CHEAT_GOD
Definition: Player.h:998
EquipmentSlots
Definition: Player.h:673
@ EQUIPMENT_SLOT_END
Definition: Player.h:694
@ NODAMAGE
Definition: Unit.h:252
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:539
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:538
@ RATE_DURABILITY_LOSS_DAMAGE
Definition: IWorld.h:516
@ ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE
Definition: DBCEnums.h:130
@ POWER_RAGE
Definition: SharedDefines.h:270
@ SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK
Definition: SharedDefines.h:647
@ SPELL_ATTR3_TREAT_AS_PERIODIC
Definition: SharedDefines.h:518
@ SPELL_ATTR3_SUPRESS_TARGET_PROCS
Definition: SharedDefines.h:510
@ DUEL_WON
Definition: SharedDefines.h:3613
@ SPELL_ATTR4_REACTIVE_DAMAGE_PROC
Definition: SharedDefines.h:544
#define ASSERT_NODEBUGINFO
Definition: Errors.h:69
bool roll_chance_f(float chance)
Definition: Random.h:53
virtual void DamageTaken(Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
Called at any Damage from any attacker (before damage apply)
Definition: UnitAI.h:369
virtual void DamageDealt(Unit *, uint32 &, DamageEffectType)
Called at any Damage to any victim (before damage apply)
Definition: UnitAI.h:362
virtual void OwnerAttackedBy(Unit *)
Definition: CreatureAI.h:172
virtual void AttackedBy(Unit *)
Definition: CreatureAI.h:149
void SetLootRecipient(Unit *unit, bool withGroup=true)
Definition: Creature.cpp:1313
void SetLastDamagedTime(time_t val)
Definition: Creature.cpp:3682
bool hasLootRecipient() const
Definition: Creature.h:232
void LowerPlayerDamageReq(uint32 unDamage, bool damagedByPlayer=true)
Definition: Creature.cpp:3788
CreatureAI * AI() const
Definition: Creature.h:143
bool IsPlayer() const
Definition: ObjectGuid.h:168
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2127
void DurabilityPointLossForEquipSlot(EquipmentSlots slot)
Definition: Player.cpp:4760
Pet * GetPet() const
Definition: Player.cpp:8862
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1177
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:14020
Pet * ToPet()
Definition: Unit.h:1741
bool IsCreatedByPlayer() const
Definition: Unit.h:1172
Unit * GetCharmer() const
Definition: Unit.cpp:10548
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.cpp:17619
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
Definition: Unit.cpp:20055
void SetHealth(uint32 val)
Definition: Unit.cpp:15405
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1163
virtual bool HasActivePowerType(Powers power)
Definition: Unit.h:803
void CombatStopWithPets(bool includingCast=false)
Definition: Unit.cpp:10394
uint32 ChannelInterruptFlags
Definition: SpellInfo.h:354
uint32 InterruptFlags
Definition: SpellInfo.h:352

References CleanDamage::absorbed_damage, ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, AddThreat(), Creature::AI(), ASSERT_NODEBUGINFO, CreatureAI::AttackedBy(), CleanDamage::attackType, SpellInfo::AttributesEx3, AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, AURA_INTERRUPT_FLAG_TAKE_DAMAGE, BASE_ATTACK, CalcAbsorbResist(), CalculatePct(), CanHaveThreatList(), CastSpell(), CHANNEL_FLAG_DELAY, CHEAT_GOD, CombatStart(), CombatStopWithPets(), CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, UnitAI::DamageDealt(), UnitAI::DamageTaken(), DealDamage(), DealDamageMods(), DIRECT_DAMAGE, DOT, Player::duel, DUEL_WON, Player::DuelComplete(), Player::DurabilityPointLossForEquipSlot(), EQUIPMENT_SLOT_END, DamageInfo::GetAbsorb(), GetAI(), GetAttackTime(), GetAuraEffectsByType(), GetCharmer(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), Player::GetCommandStatus(), DamageInfo::GetDamage(), GameTime::GetGameTime(), Object::GetGUID(), GetHealth(), GetOwnerGUID(), Player::GetPet(), DamageInfo::GetResist(), Object::GetTypeId(), HasActivePowerType(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellCastTargets::HasDstChannel(), Creature::hasLootRecipient(), HasUnitState(), CleanDamage::hitOutCome, SpellInfo::Id, InterruptNonMeleeSpells(), IsAIEnabled, IsAlive(), IsControlledByPlayer(), IsCreatedByPlayer(), IsImmunedToDamageOrSchool(), IsInCombatWith(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), IsVehicle(), Kill(), LOG_DEBUG, Creature::LowerPlayerDamageReq(), m_currentSpells, m_movedByPlayer, Spell::m_targets, MAX_AGGRO_RESET_TIME, MELEE_HIT_CRIT, ModifyHealth(), NODAMAGE, OFF_ATTACK, CreatureAI::OwnerAttackedBy(), POWER_RAGE, RANGED_ATTACK, RATE_DURABILITY_LOSS_DAMAGE, RemoveAurasWithInterruptFlags(), RewardRage(), roll_chance_f(), SCORE_DAMAGE_DONE, SendSpellNonMeleeDamageLog(), SetHealth(), Creature::SetLastDamagedTime(), Creature::SetLootRecipient(), SPELL_ATTR3_SUPRESS_TARGET_PROCS, SPELL_ATTR3_TREAT_AS_PERIODIC, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR7_DONT_CAUSE_SPELL_PUSHBACK, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_SHARE_DAMAGE_PCT, SPELL_DIRECT_DAMAGE, SPELL_INTERRUPT_FLAG_ABORT_ON_DMG, SPELL_INTERRUPT_FLAG_PUSH_BACK, SPELL_STATE_CASTING, SPELL_STATE_PREPARING, sScriptMgr, sWorld, Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_EVADE, Player::UpdateAchievementCriteria(), and urand().

Referenced by CalcAbsorbResist(), DealDamage(), DealMeleeDamage(), DealSpellDamage(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), Spell::EffectInstaKill(), Player::EnvironmentalDamage(), spell_mt_phoenix_burn::HandleAfterCast(), spell_alar_ember_blast::HandleCast(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), spell_svala_ritual_strike::HandleDummyEffect(), spell_lady_vashj_magic_barrier::HandleEffectRemove(), spell_algalon_collapse_aura::HandlePeriodic(), spell_kaelthas_burn::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_gluth_decimate::HandleScriptEffect(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied(), spell_valkyr_touch::spell_valkyr_touchAuraScript::PrepareAuraScript(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ DealDamageMods()

◆ DealHeal()

int32 Unit::DealHeal ( Unit healer,
Unit victim,
uint32  addhealth 
)
static
10887{
10888 int32 gain = 0;
10889
10890 if (healer)
10891 {
10892 if (victim->IsAIEnabled)
10893 victim->GetAI()->HealReceived(healer, addhealth);
10894
10895 if (healer->IsAIEnabled)
10896 healer->GetAI()->HealDone(victim, addhealth);
10897 }
10898
10899 if (addhealth)
10900 gain = victim->ModifyHealth(int32(addhealth));
10901
10902 // Hook for OnHeal Event
10903 sScriptMgr->OnHeal(healer, victim, (uint32&)gain);
10904
10905 Unit* unit = healer;
10906
10907 if (healer && healer->GetTypeId() == TYPEID_UNIT && healer->ToCreature()->IsTotem())
10908 unit = healer->GetOwner();
10909
10910 if (!unit)
10911 return gain;
10912
10913 if (Player* player = unit->ToPlayer())
10914 {
10915 if (Battleground* bg = player->GetBattleground())
10916 bg->UpdatePlayerScore(player, SCORE_HEALING_DONE, gain);
10917
10918 // use the actual gain, as the overheal shall not be counted, skip gain 0 (it ignored anyway in to criteria)
10919 if (gain && player->InBattleground()) // pussywizard: InBattleground() optimization
10920 player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, gain, 0, victim);
10921
10922 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEAL_CASTED, addhealth); // pussywizard: optimization
10923 }
10924
10925 /*if (Player* player = victim->ToPlayer())
10926 {
10927 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED, gain); // pussywizard: optimization
10928 //player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_HEALING_RECEIVED, addhealth); // pussywizard: optimization
10929 }*/
10930
10931 return gain;
10932}
@ SCORE_HEALING_DONE
Definition: BattlegroundScore.h:34
@ ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE
Definition: DBCEnums.h:169
virtual void HealReceived(Unit *, uint32 &)
Called when the creature receives heal.
Definition: UnitAI.h:372
virtual void HealDone(Unit *, uint32 &)
Called when the unit heals.
Definition: UnitAI.h:378

References ACHIEVEMENT_CRITERIA_TYPE_HEALING_DONE, GetAI(), GetOwner(), Object::GetTypeId(), UnitAI::HealDone(), UnitAI::HealReceived(), IsAIEnabled, IsTotem(), ModifyHealth(), SCORE_HEALING_DONE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), and TYPEID_UNIT.

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), HealBySpell(), and npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI().

◆ DealMeleeDamage()

void Unit::DealMeleeDamage ( CalcDamageInfo damageInfo,
bool  durabilityLoss 
)
Todo:
: Move this to a packet handler
1817{
1818 Unit* victim = damageInfo->target;
1819
1820 auto canTakeMeleeDamage = [&]()
1821 {
1822 return victim->IsAlive() && !victim->HasUnitState(UNIT_STATE_IN_FLIGHT) && (victim->GetTypeId() != TYPEID_UNIT || !victim->ToCreature()->IsEvadingAttacks());
1823 };
1824
1825 if (!canTakeMeleeDamage())
1826 {
1827 return;
1828 }
1829
1830 // Hmmmm dont like this emotes client must by self do all animations
1831 if (damageInfo->HitInfo & HITINFO_CRITICALHIT)
1833 if (damageInfo->blocked_amount && damageInfo->TargetState != VICTIMSTATE_BLOCKS)
1835
1836 if (damageInfo->TargetState == VICTIMSTATE_PARRY)
1837 {
1838 // Get attack timers
1839 float offtime = float(victim->getAttackTimer(OFF_ATTACK));
1840 float basetime = float(victim->getAttackTimer(BASE_ATTACK));
1841 // Reduce attack time
1842 if (victim->haveOffhandWeapon() && offtime < basetime)
1843 {
1844 float percent20 = victim->GetAttackTime(OFF_ATTACK) * 0.20f;
1845 float percent60 = 3.0f * percent20;
1846 if (offtime > percent20 && offtime <= percent60)
1847 victim->setAttackTimer(OFF_ATTACK, uint32(percent20));
1848 else if (offtime > percent60)
1849 {
1850 offtime -= 2.0f * percent20;
1851 victim->setAttackTimer(OFF_ATTACK, uint32(offtime));
1852 }
1853 }
1854 else
1855 {
1856 float percent20 = victim->GetAttackTime(BASE_ATTACK) * 0.20f;
1857 float percent60 = 3.0f * percent20;
1858 if (basetime > percent20 && basetime <= percent60)
1859 victim->setAttackTimer(BASE_ATTACK, uint32(percent20));
1860 else if (basetime > percent60)
1861 {
1862 basetime -= 2.0f * percent20;
1863 victim->setAttackTimer(BASE_ATTACK, uint32(basetime));
1864 }
1865 }
1866 }
1867
1868 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
1869 {
1870 if (!canTakeMeleeDamage() || (!damageInfo->damages[i].damage && !damageInfo->damages[i].absorb && !damageInfo->damages[i].resist))
1871 {
1872 continue;
1873 }
1874
1875 // Call default DealDamage
1876 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->damages[i].absorb, damageInfo->attackType, damageInfo->hitOutCome);
1877 Unit::DealDamage(this, victim, damageInfo->damages[i].damage, &cleanDamage, DIRECT_DAMAGE, SpellSchoolMask(damageInfo->damages[i].damageSchoolMask), nullptr, durabilityLoss);
1878 }
1879
1880 // If this is a creature and it attacks from behind it has a probability to daze it's victim
1881 if ((damageInfo->damages[0].damage + damageInfo->damages[1].damage) && ((damageInfo->hitOutCome == MELEE_HIT_CRIT || damageInfo->hitOutCome == MELEE_HIT_CRUSHING || damageInfo->hitOutCome == MELEE_HIT_NORMAL || damageInfo->hitOutCome == MELEE_HIT_GLANCING) &&
1882 GetTypeId() != TYPEID_PLAYER && !ToCreature()->IsControlledByPlayer() && !victim->HasInArc(M_PI, this)
1883 && (victim->IsPlayer() || !victim->ToCreature()->isWorldBoss()) && !victim->IsVehicle()))
1884 {
1885 // -probability is between 0% and 40%
1886 // 20% base chance
1887 float Probability = 20.0f;
1888
1889 // there is a newbie protection, at level 10 just 7% base chance; assuming linear function
1890 if (victim->GetLevel() < 30)
1891 Probability = 0.65f * victim->GetLevel() + 0.5f;
1892
1893 uint32 VictimDefense = victim->GetDefenseSkillValue();
1894 uint32 AttackerMeleeSkill = GetUnitMeleeSkill();
1895
1896 // xinef: fix daze mechanics
1897 Probability -= ((float)VictimDefense - AttackerMeleeSkill) * 0.1428f;
1898
1899 if (Probability > 40.0f)
1900 Probability = 40.0f;
1901
1902 // Daze application
1903 if (sWorld->getBoolConfig(CONFIG_ENABLE_DAZE))
1904 if (roll_chance_f(std::max(0.0f, Probability)))
1905 CastSpell(victim, 1604, true);
1906 }
1907
1908 if (IsPlayer())
1909 ToPlayer()->CastItemCombatSpell(victim, damageInfo->attackType, damageInfo->procVictim, damageInfo->procEx);
1910
1911 // Do effect if any damage done to target
1912 if (damageInfo->damages[0].damage + damageInfo->damages[1].damage)
1913 {
1914 // We're going to call functions which can modify content of the list during iteration over it's elements
1915 // Let's copy the list so we can prevent iterator invalidation
1917 for (AuraEffectList::const_iterator dmgShieldItr = vDamageShieldsCopy.begin(); dmgShieldItr != vDamageShieldsCopy.end(); ++dmgShieldItr)
1918 {
1919 SpellInfo const* i_spellProto = (*dmgShieldItr)->GetSpellInfo();
1920 // Damage shield can be resisted...
1921 if (SpellMissInfo missInfo = victim->SpellHitResult(this, i_spellProto, false))
1922 {
1923 victim->SendSpellMiss(this, i_spellProto->Id, missInfo);
1924 continue;
1925 }
1926
1927 // ...or immuned
1928 if (IsImmunedToDamageOrSchool(i_spellProto))
1929 {
1930 victim->SendSpellDamageImmune(this, i_spellProto->Id);
1931 continue;
1932 }
1933
1934 uint32 damage = uint32(std::max(0, (*dmgShieldItr)->GetAmount())); // xinef: done calculated at amount calculation
1935
1936 if (Unit* caster = (*dmgShieldItr)->GetCaster())
1937 {
1938 damage = caster->SpellDamageBonusDone(this, i_spellProto, damage, SPELL_DIRECT_DAMAGE, (*dmgShieldItr)->GetEffIndex());
1939 damage = this->SpellDamageBonusTaken(caster, i_spellProto, damage, SPELL_DIRECT_DAMAGE);
1940 }
1941
1942 uint32 absorb = 0;
1943
1944 DamageInfo dmgInfo(victim, this, damage, i_spellProto, i_spellProto->GetSchoolMask(), SPELL_DIRECT_DAMAGE);
1945 Unit::CalcAbsorbResist(dmgInfo);
1946 absorb = dmgInfo.GetAbsorb();
1947 damage = dmgInfo.GetDamage();
1948
1949 Unit::DealDamageMods(this, damage, &absorb);
1950
1952 WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8 + 8 + 4 + 4 + 4 + 4));
1953 data << victim->GetGUID();
1954 data << GetGUID();
1955 data << uint32(i_spellProto->Id);
1956 data << uint32(damage); // Damage
1957 int32 overkill = int32(damage) - int32(GetHealth());
1958 data << uint32(overkill > 0 ? overkill : 0); // Overkill
1959 data << uint32(i_spellProto->GetSchoolMask());
1960 victim->SendMessageToSet(&data, true);
1961
1962 Unit::DealDamage(victim, this, damage, 0, SPELL_DIRECT_DAMAGE, i_spellProto->GetSchoolMask(), i_spellProto, true);
1963 }
1964 }
1965}
@ CONFIG_ENABLE_DAZE
Definition: IWorld.h:190
@ EMOTE_ONESHOT_WOUND_CRITICAL
Definition: SharedDefines.h:1924
@ EMOTE_ONESHOT_PARRY_SHIELD
Definition: SharedDefines.h:1930
SpellMissInfo
Definition: SharedDefines.h:1518
@ SMSG_SPELLDAMAGESHIELD
Definition: Opcodes.h:621
bool isWorldBoss() const
Definition: Creature.h:123
bool HasInArc(float arcangle, const Position *pos, float targetRadius=0.0f) const
Definition: Position.cpp:140
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx)
Definition: Player.cpp:7155
uint32 GetUnitMeleeSkill(Unit const *target=nullptr) const
Definition: Unit.h:981
void SendSpellMiss(Unit *target, uint32 spellID, SpellMissInfo missInfo)
Definition: Unit.cpp:6396
uint32 GetDefenseSkillValue(Unit const *target=nullptr) const
Definition: Unit.cpp:3592
void SendSpellDamageImmune(Unit *target, uint32 spellId)
Definition: Unit.cpp:6420
SpellMissInfo SpellHitResult(Unit *victim, SpellInfo const *spell, bool canReflect=false)
Definition: Unit.cpp:3437
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, uint32 stack=1)
Definition: Unit.cpp:11726
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:1967
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:1986

References CalcDamageInfo::absorb, CalcDamageInfo::attackType, BASE_ATTACK, CalcDamageInfo::blocked_amount, CalcAbsorbResist(), Player::CastItemCombatSpell(), CastSpell(), CalcDamageInfo::cleanDamage, CONFIG_ENABLE_DAZE, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, DealDamage(), DealDamageMods(), DIRECT_DAMAGE, EMOTE_ONESHOT_PARRY_SHIELD, EMOTE_ONESHOT_WOUND_CRITICAL, DamageInfo::GetAbsorb(), GetAttackTime(), getAttackTimer(), GetAuraEffectsByType(), DamageInfo::GetDamage(), GetDefenseSkillValue(), Object::GetGUID(), GetHealth(), GetLevel(), SpellInfo::GetSchoolMask(), Object::GetTypeId(), GetUnitMeleeSkill(), HandleEmoteCommand(), Position::HasInArc(), HasUnitState(), haveOffhandWeapon(), CalcDamageInfo::HitInfo, HITINFO_CRITICALHIT, CalcDamageInfo::hitOutCome, SpellInfo::Id, IsAlive(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), IsImmunedToDamageOrSchool(), Object::IsPlayer(), IsVehicle(), Creature::isWorldBoss(), MAX_ITEM_PROTO_DAMAGES, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_GLANCING, MELEE_HIT_NORMAL, OFF_ATTACK, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, CalcDamageInfo::resist, roll_chance_f(), WorldObject::SendMessageToSet(), SendSpellDamageImmune(), SendSpellMiss(), setAttackTimer(), SMSG_SPELLDAMAGESHIELD, SPELL_AURA_DAMAGE_SHIELD, SPELL_DIRECT_DAMAGE, SpellDamageBonusTaken(), SpellHitResult(), sWorld, CalcDamageInfo::target, CalcDamageInfo::TargetState, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_IN_FLIGHT, VICTIMSTATE_BLOCKS, and VICTIMSTATE_PARRY.

Referenced by AttackerStateUpdate(), and spell_dk_dancing_rune_weapon::HandleProc().

◆ DealSpellDamage()

void Unit::DealSpellDamage ( SpellNonMeleeDamage damageInfo,
bool  durabilityLoss,
Spell const *  spell = nullptr 
)
1426{
1427 if (damageInfo == 0)
1428 return;
1429
1430 Unit* victim = damageInfo->target;
1431
1432 if (!victim)
1433 return;
1434
1435 if (!victim->IsAlive() || victim->IsInFlight() || (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks()))
1436 return;
1437
1438 SpellInfo const* spellProto = damageInfo->spellInfo;
1439 if (!spellProto)
1440 {
1441 LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo");
1442 return;
1443 }
1444
1445 // Call default DealDamage
1446 CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
1447 Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell);
1448}
SpellInfo const * spellInfo
Definition: Unit.h:497
bool IsInFlight() const
Definition: Unit.h:1020

References SpellNonMeleeDamage::absorb, BASE_ATTACK, SpellNonMeleeDamage::cleanDamage, SpellNonMeleeDamage::damage, DealDamage(), Object::GetTypeId(), IsAlive(), Creature::IsEvadingAttacks(), IsInFlight(), LOG_DEBUG, MELEE_HIT_NORMAL, SpellNonMeleeDamage::schoolMask, SPELL_DIRECT_DAMAGE, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToCreature(), and TYPEID_UNIT.

Referenced by Spell::DoAllEffectOnTarget(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ DelayOwnedAuras()

void Unit::DelayOwnedAuras ( uint32  spellId,
ObjectGuid  caster,
int32  delaytime 
)
5414{
5415 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
5416 for (; range.first != range.second; ++range.first)
5417 {
5418 Aura* aura = range.first->second;
5419 if (!caster || aura->GetCasterGUID() == caster)
5420 {
5421 if (aura->GetDuration() < delaytime)
5422 aura->SetDuration(0);
5423 else
5424 aura->SetDuration(aura->GetDuration() - delaytime);
5425
5426 // update for out of range group members (on 1 slot use)
5428 LOG_DEBUG("spells.aura", "Aura {} partially interrupted on unit {}, new duration: {} ms", aura->GetId(), GetGUID().ToString(), aura->GetDuration());
5429 }
5430 }
5431}
std::pair< AuraMap::iterator, AuraMap::iterator > AuraMapBoundsNonConst
Definition: Unit.h:637
int32 GetDuration() const
Definition: SpellAuras.h:133
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1258
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:868

References Aura::GetCasterGUID(), Aura::GetDuration(), Object::GetGUID(), Aura::GetId(), LOG_DEBUG, m_ownedAuras, Aura::SetDuration(), Aura::SetNeedClientUpdateForTargets(), and Position::ToString().

◆ DeleteCharmInfo()

void Unit::DeleteCharmInfo ( )
15748{
15749 if (!m_charmInfo)
15750 return;
15751
15753 delete m_charmInfo;
15754 m_charmInfo = nullptr;
15755}
void RestoreState()
Definition: CharmInfo.cpp:46

References m_charmInfo, and CharmInfo::RestoreState().

Referenced by RemoveCharmedBy().

◆ DeMorph()

void Unit::DeMorph ( )
4315{
4317}
virtual void SetDisplayId(uint32 modelId, float displayScale=1.f)
Definition: Unit.cpp:16690
uint32 GetNativeDisplayId() const
Definition: Unit.h:1513

References GetNativeDisplayId(), and SetDisplayId().

Referenced by modify_commandscript::HandleMorphResetCommand().

◆ DisableRotate()

void Unit::DisableRotate ( bool  apply)
18193{
18194 if (GetTypeId() != TYPEID_UNIT)
18195 return;
18196
18197 if (apply)
18201}
@ UNIT_STATE_POSSESSED
Definition: UnitDefines.h:165
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition: Unit.h:826

References Object::GetTypeId(), HasUnitState(), RemoveUnitFlag(), SetUnitFlag(), TYPEID_UNIT, UNIT_FLAG_POSSESSED, and UNIT_STATE_POSSESSED.

Referenced by boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), boss_thorim::boss_thorimAI::DisableThorim(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_anub_arak::boss_anub_arakAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::boss_ignisAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::MovementInform(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_ignis::boss_ignisAI::Reset(), boss_kologarn::boss_kologarnAI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ DisableSpline()

◆ Dismount()

void Unit::Dismount ( )
13460{
13461 if (!IsMounted())
13462 return;
13463
13466
13467 if (Player* thisPlayer = ToPlayer())
13468 {
13469 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
13470 data << GetPackGUID();
13471 data << uint32(GameTime::GetGameTime().count()); // Packet counter
13472 data << thisPlayer->GetCollisionHeight();
13473 thisPlayer->GetSession()->SendPacket(&data);
13474 }
13475
13476 WorldPacket data(SMSG_DISMOUNT, 8);
13477 data << GetPackGUID();
13478 SendMessageToSet(&data, true);
13479
13480 // dismount as a vehicle
13481 if (IsPlayer() && GetVehicleKit())
13482 {
13483 // Send other players that we are no longer a vehicle
13484 data.Initialize(SMSG_PLAYER_VEHICLE_DATA, 8 + 4);
13485 data << GetPackGUID();
13486 data << uint32(0);
13487 ToPlayer()->SendMessageToSet(&data, true);
13488 // Remove vehicle from player
13490 }
13491
13493
13494 // only resummon old pet if the player is already added to a map
13495 // this prevents adding a pet to a not created map which would otherwise cause a crash
13496 // (it could probably happen when logging in after a previous crash)
13497 if (Player* player = ToPlayer())
13498 {
13499 sScriptMgr->AnticheatSetUnderACKmount(player);
13500
13501 if (Pet* pPet = player->GetPet())
13502 {
13503 if (pPet->HasUnitFlag(UNIT_FLAG_STUNNED) && !pPet->HasUnitState(UNIT_STATE_STUNNED))
13504 pPet->RemoveUnitFlag(UNIT_FLAG_STUNNED);
13505 }
13506 else
13507 player->ResummonPetTemporaryUnSummonedIfAny();
13508
13509 // xinef: if we have charmed npc, remove stun also
13510 if (Unit* charm = player->GetCharm())
13511 if (charm->GetTypeId() == TYPEID_UNIT && !charm->HasUnitState(UNIT_STATE_STUNNED))
13512 charm->RemoveUnitFlag(UNIT_FLAG_STUNNED);
13513 }
13514}
@ AURA_INTERRUPT_FLAG_NOT_MOUNTED
Definition: SpellDefines.h:50
@ UNIT_FIELD_MOUNTDISPLAYID
Definition: UpdateFields.h:126
@ UNIT_FLAG_STUNNED
Definition: UnitDefines.h:247
@ UNIT_FLAG_MOUNT
Definition: UnitDefines.h:256
@ SMSG_PLAYER_VEHICLE_DATA
Definition: Opcodes.h:1221
@ SMSG_MOVE_SET_COLLISION_HGT
Definition: Opcodes.h:1332
@ SMSG_DISMOUNT
Definition: Opcodes.h:970
void SendMessageToSet(WorldPacket const *data, bool self) const override
Definition: Player.cpp:5612
void RemoveVehicleKit()
Definition: Unit.cpp:18644

References AURA_INTERRUPT_FLAG_NOT_MOUNTED, GetCharm(), GameTime::GetGameTime(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), IsMounted(), Object::IsPlayer(), RemoveAurasWithInterruptFlags(), RemoveUnitFlag(), RemoveVehicleKit(), WorldObject::SendMessageToSet(), Player::SendMessageToSet(), SetUInt32Value(), SMSG_DISMOUNT, SMSG_MOVE_SET_COLLISION_HGT, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, UNIT_FLAG_STUNNED, and UNIT_STATE_STUNNED.

Referenced by _EnterVehicle(), Player::CleanupAfterTaxiFlight(), FlightPathMovementGenerator::DoFinalize(), BattlegroundWS::EventPlayerClickedOnFlag(), AuraEffect::HandleAuraMounted(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), npc_scarlet_courier::npc_scarlet_courierAI::JustEngagedWith(), boss_mandokir::boss_mandokirAI::JustEngagedWith(), boss_captain_skarloc::MovementInform(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnApply(), Creature::setDeathState(), SetInCombatState(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), npc_magister_aledis::StartFight(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ EnergizeBySpell()

void Unit::EnergizeBySpell ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
11207{
11208 int32 gainedPower = victim->ModifyPower(powerType, damage, false);
11209
11210 if (powerType != POWER_HAPPINESS && gainedPower)
11211 {
11212 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
11213 victim->getHostileRefMgr().threatAssist(this, float(gainedPower) * 0.5f, spellInfo);
11214 }
11215
11216 SendEnergizeSpellLog(victim, spellID, damage, powerType);
11217}
@ POWER_HAPPINESS
Definition: SharedDefines.h:273
void threatAssist(Unit *victim, float baseThreat, SpellInfo const *threatSpell=nullptr)
Definition: HostileRefMgr.cpp:35
void SendEnergizeSpellLog(Unit *victim, uint32 SpellID, uint32 Damage, Powers powertype)
Definition: Unit.cpp:11195

References getHostileRefMgr(), ModifyPower(), POWER_HAPPINESS, SendEnergizeSpellLog(), sSpellMgr, and HostileRefMgr::threatAssist().

Referenced by Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerDrain(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ EnterVehicle()

void Unit::EnterVehicle ( Unit base,
int8  seatId = -1 
)
19547{
19549
19550 if (Player* player = ToPlayer())
19551 {
19552 sScriptMgr->AnticheatSetUnderACKmount(player);
19553 }
19554}
@ TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE
Will ignore caster aura states including combat requirements and death state.
Definition: SpellDefines.h:144
@ VEHICLE_SPELL_RIDE_HARDCODED
Definition: VehicleDefines.h:52

References CastCustomSpell(), SPELLVALUE_BASE_POINT0, sScriptMgr, Object::ToPlayer(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, and VEHICLE_SPELL_RIDE_HARDCODED.

Referenced by debug_commandscript::HandleDebugEnterVehicleCommand(), WorldSession::HandleEnterPlayerVehicle(), boss_mimiron::boss_mimironAI::JustEngagedWith(), npc_pilgrims_bounty_chair::UpdateAI(), and boss_mimiron::boss_mimironAI::UpdateAI().

◆ EnterVehicleUnattackable()

void Unit::EnterVehicleUnattackable ( Unit base,
int8  seatId = -1 
)

◆ ExecuteDelayedUnitAINotifyEvent()

void Unit::ExecuteDelayedUnitAINotifyEvent ( )
20414{
20416 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
20417 return;
20418
20419 Acore::AIRelocationNotifier notifier(*this);
20420 float radius = 60.0f;
20421 Cell::VisitAllObjects(this, notifier, radius);
20422}
@ NOTIFY_AI_RELOCATION
Definition: Object.h:66
void RemoveFromNotify(uint16 f)
Definition: Object.h:565
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:207
Definition: GridNotifiers.h:91

References IsDuringRemoveFromWorld(), Object::IsInWorld(), NOTIFY_AI_RELOCATION, WorldObject::RemoveFromNotify(), and Cell::VisitAllObjects().

Referenced by Update().

◆ ExecuteDelayedUnitRelocationEvent()

void Unit::ExecuteDelayedUnitRelocationEvent ( )
20307{
20309 if (!this->IsInWorld() || this->IsDuringRemoveFromWorld())
20310 return;
20311
20312 if (this->HasSharedVision())
20313 for (SharedVisionList::const_iterator itr = this->GetSharedVisionList().begin(); itr != this->GetSharedVisionList().end(); ++itr)
20314 if (Player* player = (*itr))
20315 {
20316 if (player->IsOnVehicle(this) || !player->IsInWorld() || player->IsDuringRemoveFromWorld()) // players on vehicles have their own event executed (due to passenger relocation)
20317 continue;
20318 WorldObject* viewPoint = player;
20319 if (player->m_seer && player->m_seer->IsInWorld())
20320 viewPoint = player->m_seer;
20321 if (!viewPoint->IsPositionValid() || !player->IsPositionValid())
20322 continue;
20323
20324 if (Unit* active = viewPoint->ToUnit())
20325 {
20326 //if (active->IsVehicle()) // always check original unit here, last notify position is not relocated
20327 // active = player;
20328
20329 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
20330 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
20331 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
20332 float distsq = dx * dx + dy * dy + dz * dz;
20333 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
20334 if (distsq < mindistsq)
20335 continue;
20336
20337 // this will be relocated below sharedvision!
20338 //active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
20339 }
20340
20341 Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
20342 Cell::VisitAllObjects(viewPoint, relocateNoLarge, player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
20343 relocateNoLarge.SendToSelf();
20344 Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
20345 Cell::VisitAllObjects(viewPoint, relocateLarge, MAX_VISIBILITY_DISTANCE);
20346 relocateLarge.SendToSelf();
20347 }
20348
20349 if (Player* player = this->ToPlayer())
20350 {
20351 WorldObject* viewPoint = player;
20352 if (player->m_seer && player->m_seer->IsInWorld())
20353 viewPoint = player->m_seer;
20354
20355 if (viewPoint->GetMapId() != player->GetMapId() || !viewPoint->IsPositionValid() || !player->IsPositionValid())
20356 return;
20357
20358 if (Unit* active = viewPoint->ToUnit())
20359 {
20360 if (active->IsVehicle())
20361 active = player;
20362
20363 if (!player->GetFarSightDistance())
20364 {
20365 float dx = active->m_last_notify_position.GetPositionX() - active->GetPositionX();
20366 float dy = active->m_last_notify_position.GetPositionY() - active->GetPositionY();
20367 float dz = active->m_last_notify_position.GetPositionZ() - active->GetPositionZ();
20368 float distsq = dx * dx + dy * dy + dz * dz;
20369
20370 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(active->FindMap()->GetEntry()->map_type);
20371 if (distsq < mindistsq)
20372 return;
20373
20374 active->m_last_notify_position.Relocate(active->GetPositionX(), active->GetPositionY(), active->GetPositionZ());
20375 }
20376 }
20377
20378 Acore::PlayerRelocationNotifier relocateNoLarge(*player, false); // visit only objects which are not large; default distance
20379 Cell::VisitAllObjects(viewPoint, relocateNoLarge, player->GetSightRange() + VISIBILITY_INC_FOR_GOBJECTS);
20380 relocateNoLarge.SendToSelf();
20381
20382 if (!player->GetFarSightDistance())
20383 {
20384 Acore::PlayerRelocationNotifier relocateLarge(*player, true); // visit only large objects; maximum distance
20385 Cell::VisitAllObjects(viewPoint, relocateLarge, MAX_VISIBILITY_DISTANCE);
20386 relocateLarge.SendToSelf();
20387 }
20388
20390 }
20391 else if (Creature* unit = this->ToCreature())
20392 {
20393 if (!unit->IsPositionValid())
20394 return;
20395
20396 float dx = unit->m_last_notify_position.GetPositionX() - unit->GetPositionX();
20397 float dy = unit->m_last_notify_position.GetPositionY() - unit->GetPositionY();
20398 float dz = unit->m_last_notify_position.GetPositionZ() - unit->GetPositionZ();
20399 float distsq = dx * dx + dy * dy + dz * dz;
20400 float mindistsq = DynamicVisibilityMgr::GetReqMoveDistSq(unit->FindMap()->GetEntry()->map_type);
20401 if (distsq < mindistsq)
20402 return;
20403
20404 unit->m_last_notify_position.Relocate(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
20405
20406 Acore::CreatureRelocationNotifier relocate(*unit);
20407 Cell::VisitAllObjects(unit, relocate, unit->GetVisibilityRange() + VISIBILITY_COMPENSATION);
20408
20410 }
20411}
#define MAX_VISIBILITY_DISTANCE
Definition: ObjectDefines.h:31
#define VISIBILITY_INC_FOR_GOBJECTS
Definition: ObjectDefines.h:28
#define VISIBILITY_COMPENSATION
Definition: ObjectDefines.h:26
@ NOTIFY_VISIBILITY_CHANGED
Definition: Object.h:67
Unit * ToUnit()
Definition: Object.h:204
void AddToNotify(uint16 f)
Definition: Object.cpp:2973
bool IsPositionValid() const
Definition: Position.cpp:175
uint32 GetMapId() const
Definition: Position.h:276
SharedVisionList const & GetSharedVisionList()
Definition: Unit.h:1232
bool HasSharedVision() const
Definition: Unit.h:1235
Definition: GridNotifiers.h:75
Definition: GridNotifiers.h:83
static float GetReqMoveDistSq(uint32 map_type)
Definition: DynamicVisibility.h:53

References WorldObject::AddToNotify(), WorldLocation::GetMapId(), Position::GetPositionX(), DynamicVisibilityMgr::GetReqMoveDistSq(), GetSharedVisionList(), HasSharedVision(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Position::IsPositionValid(), MAX_VISIBILITY_DISTANCE, NOTIFY_AI_RELOCATION, NOTIFY_VISIBILITY_CHANGED, WorldObject::RemoveFromNotify(), Acore::VisibleNotifier::SendToSelf(), Object::ToCreature(), Object::ToPlayer(), Object::ToUnit(), VISIBILITY_COMPENSATION, VISIBILITY_INC_FOR_GOBJECTS, and Cell::VisitAllObjects().

◆ ExitVehicle()

void Unit::ExitVehicle ( Position const *  exitPosition = nullptr)

This function can be called at upper level code to initialize an exit from the passenger's side.

The following call would not even be executed successfully as the SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without specifying an exitposition. The subsequent call below would return on if (!m_vehicle).

To do: We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts to specify exit coordinates and either store those per passenger, or we need to init spline movement based on those coordinates in unapply handlers, and relocate exiting passengers based on Unit::moveSpline data. Either way, Coming Soon(TM)

19643{
19645 if (!m_vehicle)
19646 return;
19647
19649 if (Player* player = ToPlayer())
19650 {
19651 player->SetCanTeleport(true);
19652 }
19656 /*_ExitVehicle(exitPosition);*/
19663
19664 if (Player* player = ToPlayer())
19665 {
19666 sScriptMgr->AnticheatSetUnderACKmount(player);
19667 }
19668}
Unit * GetVehicleBase() const
Definition: Unit.cpp:18659

References Object::GetGUID(), GetVehicleBase(), m_vehicle, RemoveAurasByType(), SPELL_AURA_CONTROL_VEHICLE, sScriptMgr, and Object::ToPlayer().

Referenced by _EnterVehicle(), Player::ActivateTaxiPathTo(), boss_mimiron::boss_mimironAI::EnterEvadeMode(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::EnterEvadeMode(), npc_ulduar_vx001::npc_ulduar_vx001AI::EnterEvadeMode(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::EnterEvadeMode(), WorldSession::HandleDismissControlledVehicle(), spell_warhead_detonate::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_ulduar_squeezed_lifeless::HandleInstaKill(), WorldSession::HandleRequestVehicleExit(), spell_vehicle_throw_passenger::HandleScript(), boss_kologarn_arms::boss_kologarn_armsAI::JustDied(), Player::ProcessDelayedOperations(), RemoveFromWorld(), Player::StopCastingCharm(), and Player::TeleportTo().

◆ FindCurrentSpellBySpellId()

◆ FinishSpell()

void Unit::FinishSpell ( CurrentSpellTypes  spellType,
bool  ok = true 
)
4053{
4054 Spell* spell = m_currentSpells[spellType];
4055 if (!spell)
4056 return;
4057
4058 if (spellType == CURRENT_CHANNELED_SPELL)
4059 spell->SendChannelUpdate(0);
4060
4061 spell->finish(ok);
4062}
void SendChannelUpdate(uint32 time)
Definition: Spell.cpp:5181

References CURRENT_CHANNELED_SPELL, Spell::finish(), m_currentSpells, and Spell::SendChannelUpdate().

Referenced by AuraEffect::HandleFeignDeath(), AuraEffect::HandleModStealth(), npc_risen_archmage::npc_risen_archmageAI::JustEngagedWith(), boss_lord_marrowgar::UpdateAI(), and GameObject::Use().

◆ GetAffectingPlayer()

Player * Unit::GetAffectingPlayer ( ) const
10566{
10567 if (!GetCharmerOrOwnerGUID())
10568 return const_cast<Unit*>(this)->ToPlayer();
10569
10570 if (Unit* owner = GetCharmerOrOwner())
10572
10573 return nullptr;
10574}
Unit * GetCharmerOrOwner() const
Definition: Unit.h:1190
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.h:1173

References GetCharmerOrOwner(), GetCharmerOrOwnerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), and Object::ToPlayer().

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), GetFactionReactionTo(), and GetReactionTo().

◆ GetAI()

UnitAI * Unit::GetAI ( )
inline
656{ return i_AI; }

References i_AI.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), spell_algalon_big_bang::CheckTargets(), DealDamage(), DealHeal(), spell_send_mug_target_picker::FilterTargets(), spell_blood_queen_bloodbolt::FilterTargets(), npc_dream_fog::npc_dream_fogAI::GetRandomUnitFromDragonThreatList(), spell_kaelthas_resurrection::HandleBeforeCast(), BattlegroundIC::HandleCapturedNodes(), spell_send_mug_target_picker::HandleDummy(), spell_magtheridon_shadow_grasp_visual::HandleDummyApply(), spell_mount_check_aura::HandleEffectPeriodic(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_random_aggro::HandleOnHit(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), spell_frostwarden_handler_focus_fire::HandleScript(), spell_ayamiss_swarmer_start_loop::HandleScript(), spell_pursue::HandleScript(), spell_xt002_gravity_bomb_damage::HandleScript(), spell_the_lich_king_quake::HandleSendEvent(), npc_risen_guardian::npc_risen_guardianAI::IsSummonedBy(), npc_risen_guardian::npc_risen_guardianAI::KilledUnit(), ModifyPower(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), achievement_respect_your_elders::OnCheck(), achievement_hadronox_denied::OnCheck(), achievement_watch_him_die::OnCheck(), achievement_better_off_dred::OnCheck(), achievement_oh_novos::OnCheck(), achievement_share_the_love::OnCheck(), achievement_snakes_whyd_it_have_to_be_snakes::OnCheck(), achievement_im_on_a_boat::OnCheck(), achievement_all_you_can_eat::OnCheck(), achievement_been_waiting_long_time::OnCheck(), achievement_neck_deep_in_vile::OnCheck(), achievement_portal_jockey::OnCheck(), achievement_chaos_theory::OnCheck(), achievement_split_personality::OnCheck(), achievement_algalon_he_feeds_on_your_tears::OnCheck(), achievement_algalon_herald_of_the_titans::OnCheck(), achievement_flame_leviathan_towers::OnCheck(), achievement_flame_leviathan_shutout::OnCheck(), achievement_freya_getting_back_to_nature::OnCheck(), achievement_freya_knock_on_wood::OnCheck(), achievement_yogg_saron_drive_me_crazy::OnCheck(), achievement_yogg_saron_kiss_and_make_up::OnCheck(), achievement_intense_cold::OnCheck(), achievement_once_bitten_twice_shy::OnCheck(), spell_xt002_gravity_bomb_aura::OnPeriodic(), spell_marrowgar_coldflame::SelectTarget(), and boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::SpellHit().

◆ GetAllMinionsByEntry()

void Unit::GetAllMinionsByEntry ( std::list< Creature * > &  Minions,
uint32  entry 
)
10787{
10788 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10789 {
10790 Unit* unit = *itr;
10791 ++itr;
10792 if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
10793 && unit->ToCreature()->IsSummon()) // minion, actually
10794 Minions.push_back(unit->ToCreature());
10795 }
10796}
bool IsSummon() const
Definition: Unit.h:751

References Object::GetEntry(), Object::GetTypeId(), IsSummon(), m_Controlled, Object::ToCreature(), and TYPEID_UNIT.

Referenced by spell_item_gift_of_the_harvester::spell_item_gift_of_the_harvester_SpellScript::CheckRequirement().

◆ GetAPMultiplier()

float Unit::GetAPMultiplier ( WeaponAttackType  attType,
bool  normalized 
)
17147{
17148 if (!normalized || GetTypeId() != TYPEID_PLAYER)
17149 return float(GetAttackTime(attType)) / 1000.0f;
17150
17151 Item* Weapon = ToPlayer()->GetWeaponForAttack(attType, true);
17152 if (!Weapon)
17153 return 2.4f; // fist attack
17154
17155 switch (Weapon->GetTemplate()->InventoryType)
17156 {
17157 case INVTYPE_2HWEAPON:
17158 return 3.3f;
17159 case INVTYPE_RANGED:
17161 case INVTYPE_THROWN:
17162 return 2.8f;
17163 case INVTYPE_WEAPON:
17166 default:
17167 return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
17168 }
17169}
@ ITEM_SUBCLASS_WEAPON_DAGGER
Definition: ItemTemplate.h:359
@ INVTYPE_RANGED
Definition: ItemTemplate.h:271
@ INVTYPE_THROWN
Definition: ItemTemplate.h:281
@ INVTYPE_RANGEDRIGHT
Definition: ItemTemplate.h:282
@ INVTYPE_WEAPON
Definition: ItemTemplate.h:269
@ INVTYPE_WEAPONMAINHAND
Definition: ItemTemplate.h:277
@ INVTYPE_WEAPONOFFHAND
Definition: ItemTemplate.h:278
@ INVTYPE_2HWEAPON
Definition: ItemTemplate.h:273
Weapon
Definition: boss_arlokk.cpp:76
Definition: Item.h:220
Item * GetWeaponForAttack(WeaponAttackType attackType, bool useable=false) const
Definition: PlayerStorage.cpp:511

References GetAttackTime(), Object::GetTypeId(), Player::GetWeaponForAttack(), INVTYPE_2HWEAPON, INVTYPE_RANGED, INVTYPE_RANGEDRIGHT, INVTYPE_THROWN, INVTYPE_WEAPON, INVTYPE_WEAPONMAINHAND, INVTYPE_WEAPONOFFHAND, ITEM_SUBCLASS_WEAPON_DAGGER, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and MeleeDamageBonusDone().

◆ GetAppliedAuras() [1/2]

◆ GetAppliedAuras() [2/2]

AuraApplicationMap const & Unit::GetAppliedAuras ( ) const
inline
1268{ return m_appliedAuras; }

References m_appliedAuras.

◆ GetArmor()

◆ getAttackerForHelper()

Unit * Unit::getAttackerForHelper ( ) const
inline
707 {
708 if (GetVictim() != nullptr)
709 return GetVictim();
710
711 if (!IsEngaged())
712 return nullptr;
713
714 if (!m_attackers.empty())
715 return *(m_attackers.begin());
716
717 return nullptr;
718 }
bool IsEngaged() const
Definition: Unit.h:1029
Unit * GetVictim() const
Definition: Unit.h:727

References GetVictim(), IsEngaged(), and m_attackers.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), PetAI::SelectNextTarget(), Creature::SelectVictim(), SetControlled(), TotemAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), and PetAI::UpdateAI().

◆ getAttackers()

◆ GetAttackTime()

◆ getAttackTimer()

◆ GetAura()

Aura * Unit::GetAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5533{
5534 AuraApplication* aurApp = GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask);
5535 return aurApp ? aurApp->GetBase() : nullptr;
5536}
AuraApplication * GetAuraApplication(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition: Unit.cpp:5513

References GetAuraApplication(), and AuraApplication::GetBase().

Referenced by Player::_addSpell(), Pet::addSpell(), spell_mage_burning_determination::CheckProc(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), boss_freya::boss_freyaAI::DoAction(), Spell::DoTriggersOnSpellHit(), Spell::EffectScriptEffect(), Spell::EffectTitanGrip(), Spell::EffectWeaponDmg(), getOrphanGUID(), spell_dk_scourge_strike::HandleAfterHit(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraLinked(), Aura::HandleAuraSpecificMods(), misc_commandscript::HandleAuraStacksCommand(), deserter_commandscript::HandleDeserterAdd(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_charge_shield_bomber::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_item_pygmy_oil::HandleDummy(), HandleDummyAuraProc(), spell_yogg_saron_sanity_well_aura::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_hodir_flash_freeze_aura::HandleEffectPeriodic(), spell_sindragosa_frost_breath::HandleInfusion(), spell_dk_blood_caked_blade::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(), spell_putricide_unstable_experiment::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_yogg_saron_sanity_reduce::HandleScriptEffect(), spell_dk_pestilence::HandleScriptEffect(), spell_pal_seal_of_vengeance::HandleScriptEffect(), spell_pri_lightwell::HandleScriptEffect(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_spiritual_insight::npc_spiritual_insightAI::IsSummonedBy(), npc_gunship::npc_gunshipAI::JustDied(), npc_brew_bubble::MoveInLineOfSight(), npc_brewfest_keg_reciver::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), spell_summoning_rhyme_aura::PeriodicTick(), Player::ProcessDelayedOperations(), BattlefieldWG::PromotePlayer(), RemoveAurasDueToSpellBySteal(), Player::ResurrectPlayer(), SetAuraStack(), boss_anomalus::boss_anomalusAI::SetData(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_pilgrims_bounty_chair::SpellHit(), boss_jaraxxus::boss_jaraxxusAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_sindragosa::boss_sindragosaAI::SpellHitTarget(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::SpellHitTarget(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::SpellHitTarget(), npc_twilight_summon::npc_twilight_summonAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ GetAuraApplication()

AuraApplication * Unit::GetAuraApplication ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5514{
5515 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5516 for (; range.first != range.second; ++range.first)
5517 {
5518 AuraApplication* app = range.first->second;
5519 Aura const* aura = app->GetBase();
5520
5521 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
5522 && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5523 && (!itemCasterGUID || aura->GetCastItemGUID() == itemCasterGUID)
5524 && (!except || except != app))
5525 {
5526 return app;
5527 }
5528 }
5529 return nullptr;
5530}
std::pair< AuraApplicationMap::const_iterator, AuraApplicationMap::const_iterator > AuraApplicationMapBounds
Definition: Unit.h:640
uint8 GetEffectMask() const
Definition: SpellAuras.h:176
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:103

References AuraApplication::GetBase(), Aura::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetEffectMask(), and m_appliedAuras.

Referenced by AuraApplication::_Remove(), GetAura(), GetAuraApplicationOfRankedSpell(), HasAura(), and Spell::UpdateChanneledTargetList().

◆ GetAuraApplicationOfRankedSpell()

AuraApplication * Unit::GetAuraApplicationOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraApplication except = nullptr 
) const
5539{
5540 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5541 while (rankSpell)
5542 {
5543 if (AuraApplication* aurApp = GetAuraApplication(rankSpell, casterGUID, itemCasterGUID, reqEffMask, except))
5544 return aurApp;
5545 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5546 }
5547 return nullptr;
5548}

References GetAuraApplication(), and sSpellMgr.

Referenced by spell_warl_drain_soul::CheckProc(), and GetAuraOfRankedSpell().

◆ GetAuraCount()

uint32 Unit::GetAuraCount ( uint32  spellId) const
5634{
5635 uint32 count = 0;
5636 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5637
5638 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5639 {
5640 if (itr->second->GetBase()->GetStackAmount() == 0)
5641 ++count;
5642 else
5643 count += (uint32)itr->second->GetBase()->GetStackAmount();
5644 }
5645
5646 return count;
5647}

References m_appliedAuras.

Referenced by npc_brew_bubble::MoveInLineOfSight(), spell_valithria_suppression_aura::OnApply(), achievement_consumption_junction::OnCheck(), achievement_assembly_of_iron::OnCheck(), achievement_cant_do_that_while_stunned::OnCheck(), spell_valithria_suppression_aura::OnRemove(), SmartScript::ProcessEvent(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), spell_black_temple_spell_absorption_aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ GetAuraEffect() [1/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5486{
5487 AuraEffectList const& auras = GetAuraEffectsByType(type);
5488 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5489 {
5490 SpellInfo const* spell = (*i)->GetSpellInfo();
5491 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5492 {
5493 if (casterGUID && (*i)->GetCasterGUID() != casterGUID)
5494 continue;
5495 return (*i);
5496 }
5497 }
5498 return nullptr;
5499}
bool HasFlag(uint32 p1=0, uint32 p2=0, uint32 p3=0) const
Definition: Util.h:468
flag96 SpellFamilyFlags
Definition: SpellInfo.h:388
uint32 SpellFamilyName
Definition: SpellInfo.h:387

References GetAuraEffectsByType(), flag96::HasFlag(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

◆ GetAuraEffect() [2/3]

AuraEffect * Unit::GetAuraEffect ( AuraType  type,
SpellFamilyNames  name,
uint32  iconId,
uint8  effIndex 
) const
5472{
5473 AuraEffectList const& auras = GetAuraEffectsByType(type);
5474 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5475 {
5476 if (effIndex != (*itr)->GetEffIndex())
5477 continue;
5478 SpellInfo const* spell = (*itr)->GetSpellInfo();
5479 if (spell->SpellIconID == iconId && spell->SpellFamilyName == name)
5480 return *itr;
5481 }
5482 return nullptr;
5483}
uint32 SpellIconID
Definition: SpellInfo.h:380

References GetAuraEffectsByType(), SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

◆ GetAuraEffect() [3/3]

AuraEffect * Unit::GetAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5446{
5447 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5448 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5449 {
5450 if (itr->second->HasEffect(effIndex)
5451 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5452 {
5453 return itr->second->GetBase()->GetEffect(effIndex);
5454 }
5455 }
5456 return nullptr;
5457}

References m_appliedAuras.

Referenced by CalculateSpellAmount(), Spell::CanAutoCast(), spell_mage_ice_barrier::CheckCast(), spell_pri_power_word_shield::CheckCast(), spell_mage_molten_armor::CheckProc(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectWeaponDmg(), spell_dru_t10_restoration_4p_bonus::FilterTargets(), GetAuraEffectOfRankedSpell(), GetDummyAuraEffect(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), spell_dk_raise_ally::HandleDummy(), spell_dk_death_coil::HandleDummy(), spell_dk_death_strike::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), spell_warl_life_tap::HandleDummy(), HandleDummyAuraProc(), spell_warr_execute::HandleEffect(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blessing_of_ancient_kings::HandleProc(), spell_pal_sacred_shield_base::HandleProc(), spell_pri_divine_aegis::HandleProc(), HandleProcTriggerSpell(), AuraEffect::HandleShapeshiftBoosts(), spell_warl_drain_soul::HandleTick(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), Guardian::InitStatsForLevel(), npc_anzu_spirit::IsSummonedBy(), MeleeDamageBonusDone(), ModSpellDuration(), spell_dk_death_and_decay::RecalculateDamage(), RemoveAurasDueToSpellByDispel(), SpellDamageBonusDone(), SpellHealingBonusTaken(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), spell_mage_incanters_absorbtion_base_AuraScript::Trigger(), and npc_hallows_end_train_fire::UpdateAI().

◆ GetAuraEffectDummy()

AuraEffect * Unit::GetAuraEffectDummy ( uint32  spellid) const
5502{
5504 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
5505 {
5506 if ((*itr)->GetId() == spellid)
5507 return *itr;
5508 }
5509
5510 return nullptr;
5511}
@ SPELL_AURA_DUMMY
Definition: SpellAuraDefines.h:67

References GetAuraEffectsByType(), and SPELL_AURA_DUMMY.

Referenced by Spell::EffectWeaponDmg(), Aura::HandleAuraSpecificMods(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_dk_scourge_strike::HandleDummy(), Guardian::InitStatsForLevel(), Kill(), spell_dk_death_and_decay::RecalculateDamage(), Player::RemoveSpellMods(), and SpellHealingBonusTaken().

◆ GetAuraEffectOfRankedSpell()

AuraEffect * Unit::GetAuraEffectOfRankedSpell ( uint32  spellId,
uint8  effIndex,
ObjectGuid  casterGUID = ObjectGuid::Empty 
) const
5460{
5461 uint32 rankSpell = sSpellMgr->GetFirstSpellInChain(spellId);
5462 while (rankSpell)
5463 {
5464 if (AuraEffect* aurEff = GetAuraEffect(rankSpell, effIndex, caster))
5465 return aurEff;
5466 rankSpell = sSpellMgr->GetNextSpellInChain(rankSpell);
5467 }
5468 return nullptr;
5469}
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5445

References GetAuraEffect(), and sSpellMgr.

Referenced by spell_mage_fire_frost_ward::Absorb(), spell_sha_earthbind_totem::Apply(), spell_sha_earthliving_weapon::CheckProc(), spell_dru_enrage::HandleApply(), spell_pal_avenging_wrath::HandleApply(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), SpellPctDamageModsDone(), and spell_mage_incanters_absorbtion_base_AuraScript::Trigger().

◆ GetAuraEffectsByType()

AuraEffectList const & Unit::GetAuraEffectsByType ( AuraType  type) const
inline
1310{ return m_modAuras[type]; }

References m_modAuras.

Referenced by Player::_ApplyWeaponDependentAuraMods(), Spell::_cast(), AuraApplication::_HandleEffect(), KillRewarder::_RewardXP(), CalcAbsorbResist(), CalcArmorReducedDamage(), CalcHealAbsorb(), AuraEffect::CalculateAmount(), Player::CalculateQuestRewardXP(), Spell::CheckCast(), Spell::CheckCasterAuras(), DealDamage(), DealMeleeDamage(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), spell_dk_wandering_plague::FilterTargets(), GetAuraEffect(), GetAuraEffectDummy(), GetDoTsByCaster(), GetMagicHitRedirectTarget(), GetMaxNegativeAuraModifier(), GetMaxNegativeAuraModifierByAffectMask(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifier(), GetMaxPositiveAuraModifierByAffectMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscValue(), Player::getMaxTimer(), GetMeleeHitRedirectTarget(), GetPhaseByAuras(), Player::GetResurrectionSpellId(), Player::GetRuneBaseCooldown(), GetTotalAuraModifier(), GetTotalAuraModifierAreaExclusive(), GetTotalAuraModifierByAffectMask(), GetTotalAuraModifierByMiscMask(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByAffectMask(), GetTotalAuraMultiplierByMiscMask(), GetTotalAuraMultiplierByMiscValue(), GetUnitCriticalChance(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), AuraEffect::HandleAuraTransform(), AuraEffect::HandleDetectAmore(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), HandleDummyAuraProc(), Spell::HandleLaunchPhase(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), modify_commandscript::HandleMorphMountCommand(), AuraEffect::HandleNoReagentUseAura(), spell_illidari_council_judgement::HandleScriptEffect(), spell_pal_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), HasAuraState(), HasAuraTypeWithAffectMask(), HasAuraTypeWithCaster(), HasAuraTypeWithFamilyFlags(), HasAuraTypeWithMiscvalue(), HasAuraTypeWithTriggerSpell(), HasAuraTypeWithValue(), HasBreakableByDamageAuraType(), HasVisibleAuraType(), IsImmunedToSpellEffect(), IsScriptOverriden(), SpellInfo::IsStrongerAuraActive(), Player::isTotalImmune(), list_commandscript::ListAurasCommand(), MeleeDamageBonusDone(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Spell::PrepareTriggersExecutedOnHit(), processDummyAuras(), spell_dru_enrage::RecalculateBaseArmor(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::Respawn(), RestoreDisplayId(), Spell::SelectImplicitAreaTargets(), Spell::SelectImplicitConeTargets(), PetAI::SelectNextTarget(), Creature::SelectVictim(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), Player::SetEntryPoint(), Player::SetSkill(), SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SpellBaseHealingBonusDone(), SpellBaseHealingBonusTaken(), SpellDamageBonusDone(), SpellDamageBonusTaken(), SpellHealingBonusDone(), SpellHealingBonusTaken(), SpellHitResult(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), SpellTakenCritChance(), Player::SummonPet(), Player::TeleportTo(), SimpleCharmedAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), Player::UpdateArmor(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCharmedAI(), Player::UpdateExpertise(), Player::UpdateManaRegen(), Player::UpdateRating(), Player::UpdateResistances(), UpdateSpeed(), and Player::UpdateStats().

◆ GetAuraOfRankedSpell()

Aura * Unit::GetAuraOfRankedSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5551{
5552 AuraApplication* aurApp = GetAuraApplicationOfRankedSpell(spellId, casterGUID, itemCasterGUID, reqEffMask);
5553 return aurApp ? aurApp->GetBase() : nullptr;
5554}
AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraApplication *except=nullptr) const
Definition: Unit.cpp:5538

References GetAuraApplicationOfRankedSpell(), and AuraApplication::GetBase().

Referenced by Aura::HandleAuraSpecificMods().

◆ GetCastingTimeForBonus()

uint32 Unit::GetCastingTimeForBonus ( SpellInfo const *  spellProto,
DamageEffectType  damagetype,
uint32  CastingTime 
) const
17007{
17008 // Not apply this to creature casted spells with casttime == 0
17009 if (CastingTime == 0 && GetTypeId() == TYPEID_UNIT && !IsPet())
17010 return 3500;
17011
17012 if (CastingTime > 7000) CastingTime = 7000;
17013 if (CastingTime < 1500) CastingTime = 1500;
17014
17015 if (damagetype == DOT && !spellProto->IsChanneled())
17016 CastingTime = 3500;
17017
17018 int32 overTime = 0;
17019 uint8 effects = 0;
17020 bool DirectDamage = false;
17021 bool AreaEffect = false;
17022
17023 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; i++)
17024 {
17025 switch (spellProto->Effects[i].Effect)
17026 {
17032 case SPELL_EFFECT_HEAL:
17033 DirectDamage = true;
17034 break;
17036 switch (spellProto->Effects[i].ApplyAuraName)
17037 {
17041 if (spellProto->GetDuration())
17042 overTime = spellProto->GetDuration();
17043 break;
17044 default:
17045 // -5% per additional effect
17046 ++effects;
17047 break;
17048 }
17049 default:
17050 break;
17051 }
17052
17053 if (spellProto->Effects[i].IsTargetingArea())
17054 AreaEffect = true;
17055 }
17056
17057 // Combined Spells with Both Over Time and Direct Damage
17058 if (overTime > 0 && DirectDamage)
17059 {
17060 // mainly for DoTs which are 3500 here otherwise
17061 uint32 OriginalCastTime = spellProto->CalcCastTime();
17062 if (OriginalCastTime > 7000) OriginalCastTime = 7000;
17063 if (OriginalCastTime < 1500) OriginalCastTime = 1500;
17064 // Portion to Over Time
17065 float PtOT = (overTime / 15000.0f) / ((overTime / 15000.0f) + (OriginalCastTime / 3500.0f));
17066
17067 if (damagetype == DOT)
17068 CastingTime = uint32(CastingTime * PtOT);
17069 else if (PtOT < 1.0f)
17070 CastingTime = uint32(CastingTime * (1 - PtOT));
17071 else
17072 CastingTime = 0;
17073 }
17074
17075 // Area Effect Spells receive only half of bonus
17076 if (AreaEffect)
17077 CastingTime /= 2;
17078
17079 // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing
17080 for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
17081 {
17082 if (spellProto->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH ||
17083 (spellProto->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && spellProto->Effects[j].ApplyAuraName == SPELL_AURA_PERIODIC_LEECH))
17084 {
17085 CastingTime /= 2;
17086 break;
17087 }
17088 }
17089
17090 // -5% of total per any additional effect
17091 for (uint8 i = 0; i < effects; ++i)
17092 CastingTime *= 0.95f;
17093
17094 return CastingTime;
17095}
@ SPELL_AURA_PERIODIC_DAMAGE
Definition: SpellAuraDefines.h:66
@ SPELL_AURA_PERIODIC_HEAL
Definition: SpellAuraDefines.h:71
@ SPELL_AURA_PERIODIC_LEECH
Definition: SpellAuraDefines.h:116
@ SPELL_EFFECT_POWER_BURN
Definition: SharedDefines.h:840
@ SPELL_EFFECT_HEALTH_LEECH
Definition: SharedDefines.h:787
@ SPELL_EFFECT_HEAL
Definition: SharedDefines.h:788
@ SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
Definition: SharedDefines.h:785
@ SPELL_EFFECT_POWER_DRAIN
Definition: SharedDefines.h:786
@ SPELL_EFFECT_SCHOOL_DAMAGE
Definition: SharedDefines.h:780
@ SPELL_EFFECT_APPLY_AURA
Definition: SharedDefines.h:784

References SpellInfo::CalcCastTime(), DOT, SpellInfo::Effects, SpellInfo::GetDuration(), Object::GetTypeId(), SpellInfo::IsChanneled(), IsPet(), MAX_SPELL_EFFECTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_POWER_BURN, SPELL_EFFECT_POWER_DRAIN, SPELL_EFFECT_SCHOOL_DAMAGE, and TYPEID_UNIT.

Referenced by CalculateDefaultCoefficient().

◆ GetCharm()

Unit * Unit::GetCharm ( ) const
10607{
10608 if (ObjectGuid charm_guid = GetCharmGUID())
10609 {
10610 if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid))
10611 return pet;
10612
10613 LOG_ERROR("entities.unit", "Unit::GetCharm: Charmed creature {} not exist.", charm_guid.ToString());
10615 }
10616
10617 return nullptr;
10618}
@ UNIT_FIELD_CHARM
Definition: UpdateFields.h:86
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
ObjectGuid GetCharmGUID() const
Definition: Unit.h:1165

References ObjectGuid::Empty, GetCharmGUID(), ObjectAccessor::GetUnit(), LOG_ERROR, Object::SetGuidValue(), and UNIT_FIELD_CHARM.

Referenced by Spell::_cast(), AddPetAura(), spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Dismount(), Spell::finish(), GetFirstControlled(), spell_warl_eye_of_kilrogg::HandleAuraApply(), spell_warl_eye_of_kilrogg::HandleAuraRemove(), spell_dk_raise_ally::HandleDummy(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), WorldSession::HandleRequestPetInfo(), isPossessing(), Mount(), Player::PossessSpellInitialize(), RemovePetAura(), Spell::SelectImplicitCasterObjectTargets(), SetSpeed(), npc_pilgrims_bounty_chair::SpellHitTarget(), and Player::StopCastingCharm().

◆ GetCharmer()

◆ GetCharmerGUID()

◆ GetCharmerOrOwner()

◆ GetCharmerOrOwnerGUID()

◆ GetCharmerOrOwnerOrOwnGUID()

◆ GetCharmerOrOwnerOrSelf()

Unit * Unit::GetCharmerOrOwnerOrSelf ( ) const
inline
1192 {
1193 if (Unit* u = GetCharmerOrOwner())
1194 return u;
1195
1196 return (Unit*)this;
1197 }

References GetCharmerOrOwner().

Referenced by CombatStart(), CombatStartOnCast(), GetPartyMembers(), GetReactionTo(), IsInPartyWith(), IsInRaidWith(), SetInCombatWith(), and TotemAI::UpdateAI().

◆ GetCharmerOrOwnerPlayerOrPlayerItself()

Player * Unit::GetCharmerOrOwnerPlayerOrPlayerItself ( ) const
10557{
10559 if (guid.IsPlayer())
10560 return ObjectAccessor::GetPlayer(*this, guid);
10561
10562 return const_cast<Unit*>(this)->ToPlayer();
10563}
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:223

References GetCharmerOrOwnerGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), and Object::ToPlayer().

Referenced by Spell::_handle_finish_phase(), spell_sha_earthbind_totem::Apply(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), BuildValuesUpdate(), spell_q12237_rescue_villager::CheckCast(), spell_q12237_drop_off_villager::CheckCast(), CombatStart(), CombatStartOnCast(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), DealDamage(), Spell::EffectGameObjectSetDestructionState(), Spell::EffectKillCredit(), Spell::EffectKillCreditPersonal(), Spell::EffectSummonPet(), GetAffectingPlayer(), Object::GetUpdateFieldData(), spell_gen_charmed_unit_spell_cooldown::HandleCast(), spell_q13007_iron_colossus::HandleDummy(), spell_pilgrims_bounty_pass_generic::HandleDummy(), spell_pilgrims_bounty_feast_on_generic::HandleDummy(), spell_q12851_going_bearback::HandleEffectApply(), spell_q12726_song_of_wind_and_water::HandleHealPct(), spell_winter_veil_racer_slam_hit::HandleScriptEffect(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_q10769_dissension_amongst_the_ranks::HandleScriptEffect(), npc_pet_gen_valkyr_guardian::InitializeAI(), isTargetableForAttack(), GuardAI::JustDied(), boss_kurinnaxx::JustDied(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustDied(), npc_darnavan::npc_darnavanAI::JustDied(), npc_four_car_garage::npc_four_car_garageAI::JustDied(), npc_scion_of_eternity::npc_scion_of_eternityAI::JustDied(), Kill(), Condition::Meets(), GameObject::ModifyHealth(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), SmartScript::ProcessAction(), ProcessTerrainStatusUpdate(), Pet::RemoveSpellCooldown(), Spell::SendSpellCooldown(), SetCharm(), SetContestedPvP(), SetInCombatState(), Creature::SetLootRecipient(), npc_deaths_door_fell_cannon_target_bunny::npc_deaths_door_fell_cannon_target_bunnyAI::SpellHit(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), and Creature::UpdateEntry().

◆ GetCharmGUID()

◆ GetCharmInfo()

◆ getClass()

uint8 Unit::getClass ( ) const
inline
765{ return GetByteValue(UNIT_FIELD_BYTES_0, 1); }
@ UNIT_FIELD_BYTES_0
Definition: UpdateFields.h:95
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:323

References Object::GetByteValue(), and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), ArenaTeam::AddMember(), SpellEffectInfo::CalcValue(), getClassMask(), GetDebugInfo(), Player::GetDodgeFromAgility(), SocialMgr::GetFriendInfo(), Player::GetMeleeCritFromAgility(), Player::GetMissPercentageFromDefence(), Player::GetPlayerName(), Player::GetRatingMultiplier(), Player::GetSpec(), Player::GetSpellCritFromIntellect(), Player::GetStartPosition(), Player::GiveLevel(), spell_item_flask_of_the_north::HandleDummy(), HandleDummyAuraProc(), learn_commandscript::HandleLearnAllMySpellsCommand(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), HandleProcTriggerSpell(), ArenaSpectator::HandleResetCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDataForForm(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Player::IsClass(), IsClass(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), ClassCallSelector::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), Player::RewardHonor(), Guild::Member::SetStats(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Player::StoreNewItemInBestSlots(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), Player::UpdateDodgePercentage(), Player::UpdateParryPercentage(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getClassMask()

◆ GetCollisionHeight()

float Unit::GetCollisionHeight ( ) const
overridevirtual

Return collision height sent to client.

Reimplemented from WorldObject.

21010{
21011 float scaleMod = GetObjectScale(); // 99% sure about this
21012 float defaultHeight = DEFAULT_COLLISION_HEIGHT * scaleMod;
21013
21014 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
21015 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
21016 float collisionHeight = 0.0f;
21017
21018 if (IsMounted())
21019 {
21021 {
21022 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
21023 {
21024 collisionHeight = scaleMod * (mountModelData->MountHeight + modelData->CollisionHeight * modelData->Scale * displayInfo->scale * 0.5f);
21025 }
21026 }
21027 }
21028 else
21029 collisionHeight = scaleMod * modelData->CollisionHeight * modelData->Scale * displayInfo->scale;
21030
21031 return collisionHeight == 0.0f ? defaultHeight : collisionHeight;
21032}
DBCStorage< CreatureDisplayInfoEntry > sCreatureDisplayInfoStore(CreatureDisplayInfofmt)
DBCStorage< CreatureModelDataEntry > sCreatureModelDataStore(CreatureModelDatafmt)
#define DEFAULT_COLLISION_HEIGHT
Definition: ObjectDefines.h:50
float GetObjectScale() const
Definition: Object.h:115
Definition: DBCStructure.h:721
uint32 ModelId
Definition: DBCStructure.h:723
float scale
Definition: DBCStructure.h:726
Definition: DBCStructure.h:775
float Scale
Definition: DBCStructure.h:779
float CollisionHeight
Definition: DBCStructure.h:790

References CreatureModelDataEntry::CollisionHeight, DEFAULT_COLLISION_HEIGHT, GetNativeDisplayId(), Object::GetObjectScale(), Object::GetUInt32Value(), IsMounted(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by DynObjAura::FillTargetMap(), WorldObject::GetNearPoint(), GetRandomContactPoint(), WorldSession::HandleMovementOpcodes(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Spell::SelectImplicitCasterDestTargets(), spell_spawn_blood_pool::SetDest(), WorldObject::UpdateAllowedPositionZ(), and Creature::UpdateMovementFlags().

◆ GetCollisionRadius()

float Unit::GetCollisionRadius ( ) const
overridevirtual

this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the radius also takes in consideration the mount size

Returns
float The radius of a unit

Reimplemented from WorldObject.

21004{
21005 return GetCollisionWidth() / 2;
21006}
float GetCollisionWidth() const override
this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by...
Definition: Unit.cpp:20966

References GetCollisionWidth().

Referenced by GetMeleeAttackPoint(), and Creature::Update().

◆ GetCollisionWidth()

float Unit::GetCollisionWidth ( ) const
overridevirtual

this method gets the diameter of a Unit by DB if any value is defined, otherwise it gets the value by the DBC

If the player is mounted the diameter also takes in consideration the mount size

Returns
float The diameter of a unit

Dismounting case - use basic default model data

Reimplemented from WorldObject.

20967{
20968 if (IsPlayer())
20969 return GetObjectSize();
20970
20971 float scaleMod = GetObjectScale(); // 99% sure about this
20972 float objectSize = GetObjectSize();
20973 float defaultSize = DEFAULT_WORLD_OBJECT_SIZE * scaleMod;
20974
20976 CreatureDisplayInfoEntry const* displayInfo = sCreatureDisplayInfoStore.AssertEntry(GetNativeDisplayId());
20977 CreatureModelDataEntry const* modelData = sCreatureModelDataStore.AssertEntry(displayInfo->ModelId);
20978
20979 if (IsMounted())
20980 {
20982 {
20983 if (CreatureModelDataEntry const* mountModelData = sCreatureModelDataStore.LookupEntry(mountDisplayInfo->ModelId))
20984 {
20985 if (G3D::fuzzyGt(mountModelData->CollisionWidth, modelData->CollisionWidth))
20986 modelData = mountModelData;
20987 }
20988 }
20989 }
20990
20991 float collisionWidth = scaleMod * modelData->CollisionWidth * modelData->Scale * displayInfo->scale * 2;
20992 // if the objectSize is the default value or the creature is mounted and we have a DBC value, then we can retrieve DBC value instead
20993 return G3D::fuzzyGt(collisionWidth, 0.0f) && (G3D::fuzzyEq(objectSize,defaultSize) || IsMounted()) ? collisionWidth : objectSize;
20994}
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: ObjectDefines.h:45
float GetObjectSize() const
Definition: Object.cpp:2768
float CollisionWidth
Definition: DBCStructure.h:789

References CreatureModelDataEntry::CollisionWidth, DEFAULT_WORLD_OBJECT_SIZE, GetNativeDisplayId(), Object::GetObjectScale(), WorldObject::GetObjectSize(), Object::GetUInt32Value(), IsMounted(), Object::IsPlayer(), CreatureDisplayInfoEntry::ModelId, CreatureDisplayInfoEntry::scale, CreatureModelDataEntry::Scale, sCreatureDisplayInfoStore, sCreatureModelDataStore, and UNIT_FIELD_MOUNTDISPLAYID.

Referenced by GetCollisionRadius().

◆ GetCombatRatingDamageReduction()

uint32 Unit::GetCombatRatingDamageReduction ( CombatRating  cr,
float  rate,
float  cap,
uint32  damage 
) const
private
19112{
19113 float percent = std::min(GetCombatRatingReduction(cr) * rate, cap);
19114 return CalculatePct(damage, percent);
19115}
float GetCombatRatingReduction(CombatRating cr) const
Definition: Unit.cpp:19099

References CalculatePct(), and GetCombatRatingReduction().

Referenced by GetMeleeCritDamageReduction(), GetMeleeDamageReduction(), GetRangedCritDamageReduction(), GetRangedDamageReduction(), GetSpellCritDamageReduction(), and GetSpellDamageReduction().

◆ GetCombatRatingReduction()

float Unit::GetCombatRatingReduction ( CombatRating  cr) const
private
19100{
19101 if (Player const* player = ToPlayer())
19102 return player->GetRatingBonusValue(cr);
19103 // Player's pet get resilience from owner
19104 else if (IsPet() && GetOwner())
19105 if (Player* owner = GetOwner()->ToPlayer())
19106 return owner->GetRatingBonusValue(cr);
19107
19108 return 0.0f;
19109}

References GetOwner(), IsPet(), and Object::ToPlayer().

Referenced by GetCombatRatingDamageReduction(), GetMeleeCritChanceReduction(), GetRangedCritChanceReduction(), and GetSpellCritChanceReduction().

◆ GetCombatReach()

◆ GetCombatTimer()

uint32 Unit::GetCombatTimer ( ) const
inline
1042{ return m_CombatTimer; }

References m_CombatTimer.

Referenced by Spell::DoSpellHitOnUnit(), and SetInCombatState().

◆ GetComboPoints() [1/2]

uint8 Unit::GetComboPoints ( ObjectGuid const &  guid) const
inline
1634{ return (m_comboTarget && m_comboTarget->GetGUID() == guid) ? m_comboPoints : 0; }

References Object::GetGUID(), m_comboPoints, and m_comboTarget.

◆ GetComboPoints() [2/2]

uint8 Unit::GetComboPoints ( Unit const *  who = nullptr) const
inline

--------—Combo point system----------------—

1633{ return (who && m_comboTarget != who) ? 0 : m_comboPoints; }

References m_comboPoints, and m_comboTarget.

Referenced by CalcSpellDuration(), SpellEffectInfo::CalcValue(), Spell::CheckCast(), and Spell::EffectSchoolDMG().

◆ GetComboTarget()

Unit * Unit::GetComboTarget ( ) const
inline
1635{ return m_comboTarget; }

References m_comboTarget.

Referenced by Player::DuelComplete(), and HandleProcTriggerSpell().

◆ GetComboTargetGUID()

ObjectGuid const Unit::GetComboTargetGUID ( ) const
inline

◆ GetCreateHealth()

◆ GetCreateMana()

◆ GetCreatePowers()

uint32 Unit::GetCreatePowers ( Powers  power) const
15588{
15589 // Only hunter pets have POWER_FOCUS and POWER_HAPPINESS
15590 switch (power)
15591 {
15592 case POWER_MANA:
15593 return GetCreateMana();
15594 case POWER_RAGE:
15595 return 1000;
15596 case POWER_FOCUS:
15597 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
15598 case POWER_ENERGY:
15599 return 100;
15600 case POWER_HAPPINESS:
15601 return (IsPlayer() || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
15602 case POWER_RUNIC_POWER:
15603 return 1000;
15604 case POWER_RUNE:
15605 return 0;
15606 case POWER_HEALTH:
15607 return 0;
15608 default:
15609 break;
15610 }
15611
15612 return 0;
15613}
@ POWER_HEALTH
Definition: SharedDefines.h:278
@ POWER_RUNIC_POWER
Definition: SharedDefines.h:275
@ POWER_ENERGY
Definition: SharedDefines.h:272
@ POWER_RUNE
Definition: SharedDefines.h:274
@ POWER_FOCUS
Definition: SharedDefines.h:271
uint32 GetCreateMana() const
Definition: Unit.h:1384

References GetCreateMana(), HUNTER_PET, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, POWER_RUNE, and POWER_RUNIC_POWER.

Referenced by Pet::CreateBaseAtTamed(), HandleDummyAuraProc(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), setPowerType(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ GetCreateStat()

float Unit::GetCreateStat ( Stats  stat) const
inline

◆ GetCreatorGUID()

ObjectGuid Unit::GetCreatorGUID ( ) const
inline
@ UNIT_FIELD_CREATEDBY
Definition: UpdateFields.h:91

References Object::GetGuidValue(), and UNIT_FIELD_CREATEDBY.

Referenced by Condition::Meets().

◆ GetCreatureType()

uint32 Unit::GetCreatureType ( ) const
15110{
15111 if (IsPlayer())
15112 {
15114 SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(form);
15115 if (ssEntry && ssEntry->creatureType > 0)
15116 return ssEntry->creatureType;
15117 else
15119 }
15120 else
15121 return ToCreature()->GetCreatureTemplate()->type;
15122}
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormEntryfmt)
ShapeshiftForm
Definition: UnitDefines.h:68
@ CREATURE_TYPE_HUMANOID
Definition: SharedDefines.h:2634
uint32 type
Definition: CreatureData.h:225
ShapeshiftForm GetShapeshiftForm() const
Definition: Unit.h:1414
Definition: DBCStructure.h:1817
int32 creatureType
Definition: DBCStructure.h:1823

References CREATURE_TYPE_HUMANOID, SpellShapeshiftFormEntry::creatureType, Creature::GetCreatureTemplate(), GetShapeshiftForm(), Object::IsPlayer(), sSpellShapeshiftFormStore, Object::ToCreature(), and CreatureTemplate::type.

Referenced by Creature::CanStartAttack(), spell_utgarde_pinnacle_beast_mark::CheckProc(), Spell::EffectKnockBack(), spell_dk_death_pact::FilterTargets(), GetCreatureTypeMask(), GetUnitParryChance(), AuraEffect::HandleAuraEmpathy(), spell_dru_starfall_dummy::HandleDummy(), IsCritter(), CreatureAI::MoveInLineOfSight(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnUnitDeath(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), SetInCombatState(), and Creature::UpdateMoveInLineOfSightState().

◆ GetCreatureTypeMask()

uint32 Unit::GetCreatureTypeMask ( ) const
inline
874 {
875 uint32 creatureType = GetCreatureType();
876 return (creatureType >= 1) ? (1 << (creatureType - 1)) : 0;
877 }
uint32 GetCreatureType() const
Definition: Unit.cpp:15109

References GetCreatureType().

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), SpellInfo::CheckTargetCreatureType(), MeleeDamageBonusDone(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ GetCritterGUID()

ObjectGuid Unit::GetCritterGUID ( ) const
inline

◆ GetCurrentSpell() [1/2]

◆ GetCurrentSpell() [2/2]

Spell * Unit::GetCurrentSpell ( uint32  spellType) const
inline
1405{ return m_currentSpells[spellType]; }

References m_currentSpells.

◆ GetCurrentSpellCastTime()

int32 Unit::GetCurrentSpellCastTime ( uint32  spell_id) const
4118{
4119 if (Spell const* spell = FindCurrentSpellBySpellId(spell_id))
4120 return spell->GetCastTime();
4121 return 0;
4122}
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition: Unit.cpp:4109

References FindCurrentSpellBySpellId().

Referenced by CasterAI::JustEngagedWith(), CasterAI::UpdateAI(), and boss_mandokir::boss_mandokirAI::UpdateAI().

◆ getDeathState()

◆ GetDebugInfo()

std::string Unit::GetDebugInfo ( ) const
overridevirtual

Reimplemented from WorldObject.

21218{
21219 std::stringstream sstr;
21220 sstr << WorldObject::GetDebugInfo() << "\n"
21221 << std::boolalpha
21222 << "AliveState: " << IsAlive()
21223 << " UnitMovementFlags: " << GetUnitMovementFlags() << " ExtraUnitMovementFlags: " << GetExtraUnitMovementFlags()
21224 << " Class: " << std::to_string(getClass());
21225 return sstr.str();
21226}
std::string GetDebugInfo() const override
Definition: Object.cpp:2481

References getClass(), WorldObject::GetDebugInfo(), GetExtraUnitMovementFlags(), GetUnitMovementFlags(), and IsAlive().

Referenced by UnitAI::GetDebugInfo(), Creature::GetDebugInfo(), and Player::GetDebugInfo().

◆ GetDefaultMovementType()

MovementGeneratorType Unit::GetDefaultMovementType ( ) const
virtual

-------—End of Pet responses methods-------—

Reimplemented in Creature.

16574{
16575 return IDLE_MOTION_TYPE;
16576}
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37

References IDLE_MOTION_TYPE.

◆ GetDefenseSkillValue()

uint32 Unit::GetDefenseSkillValue ( Unit const *  target = nullptr) const
3593{
3594 if (IsPlayer())
3595 {
3596 // in PvP use full skill instead current skill value
3597 uint32 value = (target && target->IsPlayer())
3600 value += uint32(ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
3601 return value;
3602 }
3603 else
3604 return GetUnitMeleeSkill(target);
3605}
@ CR_DEFENSE_SKILL
Definition: Unit.h:218
@ SKILL_DEFENSE
Definition: SharedDefines.h:2881
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:5393
uint16 GetMaxSkillValue(uint32 skill) const
Definition: Player.cpp:5410

References CR_DEFENSE_SKILL, Player::GetMaxSkillValue(), Player::GetSkillValue(), GetUnitMeleeSkill(), Object::IsPlayer(), SKILL_DEFENSE, and Object::ToPlayer().

Referenced by spell_pal_ardent_defender::Absorb(), DealMeleeDamage(), GetUnitCriticalChance(), RollMeleeOutcomeAgainst(), SpellTakenCritChance(), Player::UpdateBlockPercentage(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetDiminishing()

DiminishingLevels Unit::GetDiminishing ( DiminishingGroup  group)
14935{
14936 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
14937 {
14938 if (i->DRGroup != group)
14939 continue;
14940
14941 if (!i->hitCount)
14942 return DIMINISHING_LEVEL_1;
14943
14944 if (!i->hitTime)
14945 return DIMINISHING_LEVEL_1;
14946
14947 // If last spell was casted more than 15 seconds ago - reset the count.
14948 if (i->stack == 0 && getMSTimeDiff(i->hitTime, GameTime::GetGameTimeMS().count()) > 15000)
14949 {
14950 i->hitCount = DIMINISHING_LEVEL_1;
14951 return DIMINISHING_LEVEL_1;
14952 }
14953 // or else increase the count.
14954 else
14955 return DiminishingLevels(i->hitCount);
14956 }
14957 return DIMINISHING_LEVEL_1;
14958}
uint32 getMSTimeDiff(uint32 oldMSTime, uint32 newMSTime)
Definition: Timer.h:110

References DIMINISHING_LEVEL_1, GameTime::GetGameTimeMS(), getMSTimeDiff(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ GetDirectTransport()

TransportBase * Unit::GetDirectTransport ( ) const

Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)

18685{
18686 if (Vehicle* veh = GetVehicle())
18687 return veh;
18688 return GetTransport();
18689}
Vehicle * GetVehicle() const
Definition: Unit.h:1697

References WorldObject::GetTransport(), and GetVehicle().

Referenced by Movement::TransportPathTransform::operator()(), SmartScript::ProcessAction(), CharmInfo::SaveStayPosition(), WaypointMovementGenerator< Creature >::StartMove(), and UpdateSplinePosition().

◆ GetDiseasesByCaster()

uint32 Unit::GetDiseasesByCaster ( ObjectGuid  casterGUID,
uint8  mode = 0 
)
5773{
5774 static const AuraType diseaseAuraTypes[] =
5775 {
5776 SPELL_AURA_PERIODIC_DAMAGE, // Frost Fever and Blood Plague
5777 SPELL_AURA_LINKED, // Crypt Fever and Ebon Plague
5779 };
5780
5781 ObjectGuid drwGUID;
5782
5783 if (Player* playerCaster = ObjectAccessor::GetPlayer(*this, casterGUID))
5784 drwGUID = playerCaster->getRuneWeaponGUID();
5785
5786 uint32 diseases = 0;
5787 for (uint8 index = 0; diseaseAuraTypes[index] != SPELL_AURA_NONE; ++index)
5788 {
5789 for (AuraEffectList::iterator i = m_modAuras[diseaseAuraTypes[index]].begin(); i != m_modAuras[diseaseAuraTypes[index]].end();)
5790 {
5791 // Get auras with disease dispel type by caster
5792 if ((*i)->GetSpellInfo()->Dispel == DISPEL_DISEASE
5793 && ((*i)->GetCasterGUID() == casterGUID || (*i)->GetCasterGUID() == drwGUID)) // if its caster or his dancing rune weapon
5794 {
5795 ++diseases;
5796
5797 if (mode == 1)
5798 {
5799 RemoveAura((*i)->GetId(), (*i)->GetCasterGUID());
5800 i = m_modAuras[diseaseAuraTypes[index]].begin();
5801 continue;
5802 }
5803 // used for glyph of scourge strike
5804 else if (mode == 2)
5805 {
5806 Aura* aura = (*i)->GetBase();
5807 if (aura && !aura->IsRemoved() && aura->GetDuration() > 0)
5808 if ((aura->GetApplyTime() + aura->GetMaxDuration() / 1000 + 8) > (GameTime::GetGameTime().count() + aura->GetDuration() / 1000))
5809 aura->SetDuration(aura->GetDuration() + 3000);
5810 }
5811 }
5812 ++i;
5813 }
5814 }
5815 return diseases;
5816}
AuraType
Definition: SpellAuraDefines.h:62
@ SPELL_AURA_LINKED
Definition: SpellAuraDefines.h:347
@ SPELL_AURA_NONE
Definition: SpellAuraDefines.h:63
@ DISPEL_DISEASE
Definition: SharedDefines.h:1375
int32 GetMaxDuration() const
Definition: SpellAuras.h:129
time_t GetApplyTime() const
Definition: SpellAuras.h:128

References DISPEL_DISEASE, Aura::GetApplyTime(), Aura::GetDuration(), GameTime::GetGameTime(), Aura::GetMaxDuration(), ObjectAccessor::GetPlayer(), Aura::IsRemoved(), m_modAuras, RemoveAura(), Aura::SetDuration(), SPELL_AURA_LINKED, SPELL_AURA_NONE, and SPELL_AURA_PERIODIC_DAMAGE.

Referenced by Spell::EffectWeaponDmg(), MeleeDamageBonusDone(), and SpellPctDamageModsDone().

◆ GetDispellableAuraList()

void Unit::GetDispellableAuraList ( Unit caster,
uint32  dispelMask,
DispelChargesList dispelList,
SpellInfo const *  dispelSpell 
)
5557{
5558 // we should not be able to dispel diseases if the target is affected by unholy blight
5559 if (dispelMask & (1 << DISPEL_DISEASE) && HasAura(50536))
5560 dispelMask &= ~(1 << DISPEL_DISEASE);
5561
5562 ReputationRank rank = GetReactionTo(caster, IsCharmed());
5563 bool positive = rank >= REP_FRIENDLY;
5564
5565 // Neutral unit not at war with caster should be treated as a friendly unit
5566 if (rank == REP_NEUTRAL)
5567 {
5568 if (Player* casterPlayer = caster->GetAffectingPlayer())
5569 {
5570 if (FactionTemplateEntry const* factionTemplateEntry = GetFactionTemplateEntry())
5571 {
5572 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
5573 {
5574 if (factionEntry->CanBeSetAtWar())
5575 {
5576 positive = !casterPlayer->GetReputationMgr().IsAtWar(factionEntry);
5577 }
5578 }
5579 }
5580 }
5581 }
5582
5583 Unit::VisibleAuraMap const* visibleAuras = GetVisibleAuras();
5584 for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
5585 {
5586 Aura* aura = itr->second->GetBase();
5587
5588 // don't try to remove passive auras
5589 if (aura->IsPassive())
5590 continue;
5591
5592 if (aura->GetSpellInfo()->GetDispelMask() & dispelMask)
5593 {
5594 if (aura->GetSpellInfo()->Dispel == DISPEL_MAGIC)
5595 {
5596 // do not remove positive auras if friendly target
5597 // negative auras if non-friendly target
5598 if (itr->second->IsPositive() == positive)
5599 continue;
5600 }
5601
5602 // Banish should only be dispelled by Mass Dispel
5603 if (aura->GetSpellInfo()->Mechanic == MECHANIC_BANISH && !dispelSpell->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
5604 {
5605 continue;
5606 }
5607
5608 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
5609 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
5610 // Polymorph instead of 1 / (5 + 1) -> 16%.
5611 bool dispel_charges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
5612 uint8 charges = dispel_charges ? aura->GetCharges() : aura->GetStackAmount();
5613 if (charges > 0)
5614 dispelList.push_back(std::make_pair(aura, charges));
5615 }
5616 }
5617}
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
Definition: SharedDefines.h:651
@ MECHANIC_BANISH
Definition: SharedDefines.h:1343
@ SPELL_ATTR0_NO_IMMUNITIES
Definition: SharedDefines.h:411
@ REP_FRIENDLY
Definition: SharedDefines.h:184
@ DISPEL_MAGIC
Definition: SharedDefines.h:1373
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5649
std::map< uint8, AuraApplication * > VisibleAuraMap
Definition: Unit.h:652
VisibleAuraMap const * GetVisibleAuras()
Definition: Unit.h:1494
uint8 GetStackAmount() const
Definition: SpellAuras.h:148
uint8 GetCharges() const
Definition: SpellAuras.h:141
bool IsPassive() const
Definition: SpellAuras.cpp:1082
uint32 Mechanic
Definition: SpellInfo.h:323
uint32 Dispel
Definition: SpellInfo.h:322

References SpellInfo::Dispel, DISPEL_DISEASE, DISPEL_MAGIC, GetAffectingPlayer(), Aura::GetCharges(), SpellInfo::GetDispelMask(), GetFactionTemplateEntry(), GetReactionTo(), Aura::GetSpellInfo(), Aura::GetStackAmount(), GetVisibleAuras(), SpellInfo::HasAttribute(), HasAura(), IsCharmed(), Aura::IsPassive(), SpellInfo::Mechanic, MECHANIC_BANISH, REP_FRIENDLY, REP_NEUTRAL, sFactionStore, SPELL_ATTR0_NO_IMMUNITIES, and SPELL_ATTR7_DISPEL_REMOVES_CHARGES.

Referenced by Spell::EffectDispel().

◆ GetDisplayId()

uint32 Unit::GetDisplayId ( ) const
inline

References Object::GetUInt32Value(), and UNIT_FIELD_DISPLAYID.

Referenced by boss_jormungarAI::AttackStart(), WorldSession::BuildPartyMemberStatsChangedPacket(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Pet::CreateBaseAtCreature(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), boss_jormungarAI::DoAction(), GetDisplayRace(), AuraEffect::HandleAuraCloneCaster(), spell_gen_model_visible::HandleEffectApply(), WorldSession::HandleMirrorImageDataRequest(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandleRequestPartyMemberStatsOpcode(), spell_death_knight_initiate_visual::HandleScriptEffect(), wp_commandscript::HandleWpShowCommand(), Guardian::InitStatsForLevel(), IsInDisallowedMountForm(), boss_tharon_ja::boss_tharon_jaAI::JustDied(), npc_scholomance_occultist::npc_scholomance_occultistAI::JustEngagedWith(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::KilledUnit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::KilledUnit(), achievement_less_rabi::OnCheck(), WretchedGhoulCleaner::operator()(), boss_leotheras_the_blind::Reset(), boss_jormungarAI::ScheduleEvents(), Creature::SetObjectScale(), boss_halion::boss_halionAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), and boss_leotheras_the_blind::UpdateAI().

◆ GetDisplayRace()

DisplayRace Unit::GetDisplayRace ( ) const
inline
DisplayRace GetDisplayRaceFromModelId(uint32 modelId) const
Definition: Unit.cpp:20928
uint32 GetDisplayId() const
Definition: Unit.h:1511

References GetDisplayId(), and GetDisplayRaceFromModelId().

Referenced by AuraEffect::HandleAuraTransform().

◆ GetDisplayRaceFromModelId()

DisplayRace Unit::GetDisplayRaceFromModelId ( uint32  modelId) const
20929{
20930 if (CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(modelId))
20931 {
20932 if (CreatureDisplayInfoExtraEntry const* displayExtra = sCreatureDisplayInfoExtraStore.LookupEntry(display->ExtendedDisplayInfoID))
20933 {
20934 return DisplayRace(displayExtra->DisplayRaceID);
20935 }
20936 }
20937 return DisplayRace::None;
20938}
DBCStorage< CreatureDisplayInfoExtraEntry > sCreatureDisplayInfoExtraStore(CreatureDisplayInfoExtrafmt)
DisplayRace
Definition: SharedDefines.h:111
Definition: DBCStructure.h:739

References sCreatureDisplayInfoExtraStore, and sCreatureDisplayInfoStore.

Referenced by GetDisplayRace().

◆ GetDoTsByCaster()

uint32 Unit::GetDoTsByCaster ( ObjectGuid  casterGUID) const
5819{
5820 static const AuraType diseaseAuraTypes[] =
5821 {
5825 };
5826
5827 uint32 dots = 0;
5828 for (AuraType const* itr = &diseaseAuraTypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
5829 {
5830 Unit::AuraEffectList const& auras = GetAuraEffectsByType(*itr);
5831 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5832 {
5833 // Get auras by caster
5834 if ((*i)->GetCasterGUID() == casterGUID)
5835 ++dots;
5836 }
5837 }
5838 return dots;
5839}
@ SPELL_AURA_PERIODIC_DAMAGE_PERCENT
Definition: SpellAuraDefines.h:152

References GetAuraEffectsByType(), SPELL_AURA_NONE, SPELL_AURA_PERIODIC_DAMAGE, and SPELL_AURA_PERIODIC_DAMAGE_PERCENT.

Referenced by SpellPctDamageModsDone().

◆ GetDummyAuraEffect()

◆ GetDynamicFlags()

◆ GetDynObject()

DynamicObject * Unit::GetDynObject ( uint32  spellId)
6080{
6081 if (m_dynObj.empty())
6082 return nullptr;
6083 for (DynObjectList::const_iterator i = m_dynObj.begin(); i != m_dynObj.end(); ++i)
6084 {
6085 DynamicObject* dynObj = *i;
6086 if (dynObj->GetSpellId() == spellId)
6087 return dynObj;
6088 }
6089 return nullptr;
6090}
Definition: DynamicObject.h:35
uint32 GetSpellId() const
Definition: DynamicObject.h:58

References DynamicObject::GetSpellId(), and m_dynObj.

Referenced by Spell::DelayedChannel(), and WorldSession::HandleFarSightOpcode().

◆ GetEffectiveResistChance()

float Unit::GetEffectiveResistChance ( Unit const *  owner,
SpellSchoolMask  schoolMask,
Unit const *  victim 
)
static
2081{
2082 float victimResistance = float(victim->GetResistance(schoolMask));
2083 if (owner)
2084 {
2085 // Xinef: pets inherit 100% of masters penetration
2086 // Xinef: excluding traps
2087 Player const* player = owner->GetSpellModOwner();
2088 if (player && owner->GetEntry() != WORLD_TRIGGER)
2089 {
2090 victimResistance += float(player->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2091 victimResistance -= float(player->GetSpellPenetrationItemMod());
2092 }
2093 else
2094 victimResistance += float(owner->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_TARGET_RESISTANCE, schoolMask));
2095 }
2096
2097 victimResistance = std::max(victimResistance, 0.0f);
2098 if (owner)
2099 victimResistance += std::max((float(victim->GetLevel()) - float(owner->GetLevel())) * 5.0f, 0.0f);
2100
2101 static uint32 const BOSS_LEVEL = 83;
2102 static float const BOSS_RESISTANCE_CONSTANT = 510.0f;
2103 uint32 level = victim->GetLevel();
2104 float resistanceConstant = 0.0f;
2105
2106 if (level == BOSS_LEVEL)
2107 resistanceConstant = BOSS_RESISTANCE_CONSTANT;
2108 else
2109 resistanceConstant = level * 5.0f;
2110
2111 return victimResistance / (victimResistance + resistanceConstant);
2112}
int32 GetSpellPenetrationItemMod() const
Definition: Player.h:1948

References Object::GetEntry(), GetLevel(), GetResistance(), GetSpellModOwner(), Player::GetSpellPenetrationItemMod(), GetTotalAuraModifierByMiscMask(), SPELL_AURA_MOD_TARGET_RESISTANCE, and WORLD_TRIGGER.

Referenced by CalcAbsorbResist(), and MagicSpellHitResult().

◆ GetExtraUnitMovementFlags()

uint16 Unit::GetExtraUnitMovementFlags ( ) const
inline

◆ GetFaction()

uint32 Unit::GetFaction ( ) const
inline

References Object::GetUInt32Value(), and UNIT_FIELD_FACTIONTEMPLATE.

Referenced by npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::AttackStart(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::AttackStart(), Creature::CanAssistTo(), spell_q10985_light_of_the_naaru::CheckProc(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), Spell::EffectDuel(), Spell::EffectSummonType(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::EnterEvadeMode(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::EnterEvadeMode(), AuctionListItemsDelayEvent::Execute(), npc_chesspiece::GetDefaultOrientationForTeam(), GetFactionTemplateEntry(), GetReactionTo(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListOwnerItemsEvent(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), WorldSession::HandleGossipHelloOpcode(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcGuidCommand(), npc_commandscript::HandleNpcInfoCommand(), npc_echo_of_medivh::HandlePieceJustDied(), WorldSession::HandlePlayerLoginFromDB(), TempSummon::InitStats(), InitTamedPet(), IsFriendly(), IsInPartyWith(), IsInRaidWith(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_escortAI::JustRespawned(), FollowerAI::JustRespawned(), SmartAI::JustRespawned(), boss_volkhan::boss_volkhanAI::JustSummoned(), Pet::LoadPetFromDB(), npc_chesspiece::npc_chesspiece(), npc_plucky::npc_pluckyAI::npc_pluckyAI(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::npc_taskmaster_fizzuleAI(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), npc_eris_hevenfire::OnQuestAccept(), npc_cork_gizelton::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), PatchValuesUpdate(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::Reset(), npc_swarm_scarab::npc_swarm_scarabAI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), WorldSession::SendAuctionHello(), SetCharmedBy(), Player::SetGameMaster(), npc_chesspiece::sGossipHello(), boss_malchezaar::SpawnInfernal(), Spell::SummonGuardian(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), npc_chesspiece::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), and Creature::UpdateMoveInLineOfSightState().

◆ GetFactionReactionTo()

ReputationRank Unit::GetFactionReactionTo ( FactionTemplateEntry const *  factionTemplateEntry,
Unit const *  target 
) const
10127{
10128 // always neutral when no template entry found
10129 if (!factionTemplateEntry)
10130 return REP_NEUTRAL;
10131
10132 FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry();
10133 if (!targetFactionTemplateEntry)
10134 return REP_NEUTRAL;
10135
10136 // xinef: check forced reputation for self also
10137 if (Player const* selfPlayerOwner = GetAffectingPlayer())
10138 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(target->GetFactionTemplateEntry()))
10139 return *repRank;
10140
10141 if (Player const* targetPlayerOwner = target->GetAffectingPlayer())
10142 {
10143 // check contested flags
10144 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
10145 && targetPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
10146 return REP_HOSTILE;
10147 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry))
10148 return *repRank;
10149 if (!target->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
10150 {
10151 if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
10152 {
10153 if (factionEntry->CanHaveReputation())
10154 {
10155 // CvP case - check reputation, don't allow state higher than neutral when at war
10156 ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry);
10157 if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry))
10158 repRank = std::min(REP_NEUTRAL, repRank);
10159 return repRank;
10160 }
10161 }
10162 }
10163 }
10164
10165 // common faction based check
10166 if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
10167 return REP_HOSTILE;
10168 if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
10169 return REP_FRIENDLY;
10170 if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
10171 return REP_FRIENDLY;
10172 if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS)
10173 return REP_HOSTILE;
10174 // neutral by default
10175 return REP_NEUTRAL;
10176}
@ PLAYER_FLAGS_CONTESTED_PVP
Definition: Player.h:482
@ UNIT_FLAG2_IGNORE_REPUTATION
Definition: UnitDefines.h:270
@ FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS
Definition: DBCEnums.h:332
@ FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
Definition: DBCEnums.h:331
bool IsFriendlyTo(FactionTemplateEntry const &entry) const
Definition: DBCStructure.h:951

References FactionTemplateEntry::faction, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS, FactionTemplateEntry::factionFlags, GetAffectingPlayer(), GetFactionTemplateEntry(), HasUnitFlag2(), FactionTemplateEntry::IsFriendlyTo(), FactionTemplateEntry::IsHostileTo(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HOSTILE, REP_NEUTRAL, sFactionStore, and UNIT_FLAG2_IGNORE_REPUTATION.

Referenced by GetReactionTo().

◆ GetFactionTemplateEntry()

FactionTemplateEntry const * Unit::GetFactionTemplateEntry ( ) const
9977{
9978 FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(GetFaction());
9979 if (!entry)
9980 {
9981 static ObjectGuid guid; // prevent repeating spam same faction problem
9982
9983 if (GetGUID() != guid)
9984 {
9985 if (Player const* player = ToPlayer())
9986 LOG_ERROR("entities.unit", "Player {} has invalid faction (faction template id) #{}", player->GetName(), GetFaction());
9987 else if (Creature const* creature = ToCreature())
9988 LOG_ERROR("entities.unit", "Creature (template id: {}) has invalid faction (faction template id) #{}", creature->GetCreatureTemplate()->Entry, GetFaction());
9989 else
9990 LOG_ERROR("entities.unit", "Unit (name={}, type={}) has invalid faction (faction template id) #{}", GetName(), uint32(GetTypeId()), GetFaction());
9991
9992 guid = GetGUID();
9993 }
9994 }
9995 return entry;
9996}
DBCStorage< FactionTemplateEntry > sFactionTemplateStore(FactionTemplateEntryfmt)
std::string const & GetName() const
Definition: Object.h:456
uint32 GetFaction() const
Definition: Unit.h:840

References GetFaction(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), LOG_ERROR, sFactionTemplateStore, Object::ToCreature(), and Object::ToPlayer().

Referenced by _IsValidAttackTarget(), Player::CanUseBattlegroundObject(), HostileRefMgr::deleteReferencesForFaction(), Spell::EffectGameObjectDamage(), GetDispellableAuraList(), GetFactionReactionTo(), GetReactionTo(), Player::GetReputationPriceDiscount(), IsContestedGuard(), IsHostileToPlayers(), IsNeutralToAll(), npc_chesspiece::OnCharmed(), and PatchValuesUpdate().

◆ GetFirstControlled()

Unit * Unit::GetFirstControlled ( ) const
11011{
11012 // Sequence: charmed, pet, other guardians
11013 Unit* unit = GetCharm();
11014 if (!unit)
11015 if (ObjectGuid guid = GetMinionGUID())
11016 unit = ObjectAccessor::GetUnit(*this, guid);
11017
11018 return unit;
11019}
ObjectGuid GetMinionGUID() const
Definition: Unit.h:1161

References GetCharm(), GetMinionGUID(), and ObjectAccessor::GetUnit().

Referenced by Player::CharmSpellInitialize(), CombatStart(), WorldSession::HandlePetSetAction(), and RemoveCharmedBy().

◆ GetFirstMinion()

Minion * Unit::GetFirstMinion ( ) const
10577{
10578 if (ObjectGuid pet_guid = GetMinionGUID())
10579 {
10580 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
10581 if (pet->HasUnitTypeMask(UNIT_MASK_MINION))
10582 return (Minion*)pet;
10583
10584 LOG_ERROR("entities.unit", "Unit::GetFirstMinion: Minion {} not exist.", pet_guid.ToString());
10585 const_cast<Unit*>(this)->SetMinionGUID(ObjectGuid::Empty);
10586 }
10587
10588 return nullptr;
10589}
Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const)
Definition: ObjectAccessor.cpp:237
void SetMinionGUID(ObjectGuid guid)
Definition: Unit.h:1162

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetMinionGUID(), LOG_ERROR, SetMinionGUID(), and UNIT_MASK_MINION.

◆ GetFollowAngle()

◆ GetGameObject()

GameObject * Unit::GetGameObject ( uint32  spellId) const
6121{
6122 for (GameObjectList::const_iterator itr = m_gameObj.begin(); itr != m_gameObj.end(); ++itr)
6123 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6124 if (go->GetSpellId() == spellId)
6125 return go;
6126
6127 return nullptr;
6128}

References ObjectAccessor::GetGameObject(), and m_gameObj.

Referenced by Player::GetGameObjectIfCanInteractWith(), and Player::TeleportTo().

◆ getGender()

◆ GetGuardianPet()

Guardian * Unit::GetGuardianPet ( ) const
10592{
10593 if (ObjectGuid pet_guid = GetPetGUID())
10594 {
10595 if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, pet_guid))
10596 if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
10597 return (Guardian*)pet;
10598
10599 LOG_FATAL("entities.unit", "Unit::GetGuardianPet: Guardian {} not exist.", pet_guid.ToString());
10600 const_cast<Unit*>(this)->SetPetGUID(ObjectGuid::Empty);
10601 }
10602
10603 return nullptr;
10604}
#define LOG_FATAL(filterType__,...)
Definition: Log.h:152
Definition: TemporarySummon.h:95
void SetPetGUID(ObjectGuid guid)
Definition: Unit.h:1166
ObjectGuid GetPetGUID() const
Definition: Unit.h:1167

References ObjectGuid::Empty, ObjectAccessor::GetCreatureOrPetOrVehicle(), GetPetGUID(), LOG_FATAL, SetPetGUID(), and UNIT_MASK_GUARDIAN.

Referenced by spell_hun_check_pet_los::CheckCast(), Spell::CheckCast(), Spell::EffectSummonPet(), GetNextRandomRaidMemberOrPet(), AuraEffect::HandleAuraDummy(), HandleAuraRaidProcFromChargeWithValue(), HandleDummyAuraProc(), AuraEffect::HandleModDamageDone(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePetSpellAutocastOpcode(), Spell::SelectImplicitCasterObjectTargets(), and SetMinion().

◆ GetHealth()

uint32 Unit::GetHealth ( ) const
inline
@ UNIT_FIELD_HEALTH
Definition: UpdateFields.h:96

References Object::GetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_SaveCharacter(), spell_yogg_saron_protective_gaze_aura::Absorb(), spell_pri_guardian_spirit::Absorb(), spell_rog_cheat_death::Absorb(), spell_pal_ardent_defender::Absorb(), boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), Spell::CheckPower(), CountPctFromCurHealth(), boss_eregos::boss_eregosAI::DamageTaken(), boss_gyth::boss_gythAI::DamageTaken(), boss_razorgore::boss_razorgoreAI::DamageTaken(), boss_majordomo::boss_majordomoAI::DamageTaken(), boss_ragnaros::boss_ragnarosAI::DamageTaken(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_julianne::DamageTaken(), boss_romulo::DamageTaken(), boss_felblood_kaelthas::DamageTaken(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::DamageTaken(), boss_halazzi::DamageTaken(), npc_halazzi_lynx::DamageTaken(), boss_headless_horseman::DamageTaken(), boss_headless_horseman_head::DamageTaken(), npc_amanitar_mushrooms::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), npc_argent_soldier::npc_argent_soldierAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_announcer_toc5::npc_announcer_toc5AI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_ick::boss_ickAI::DamageTaken(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::DamageTaken(), boss_drakkari_colossus::boss_drakkari_colossusAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), npc_collapsing_star::npc_collapsing_starAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), npc_akama_illidan::npc_akama_illidanAI::DamageTaken(), boss_illidari_council::DamageTaken(), boss_illidari_council_memberAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_the_lurker_below::DamageTaken(), npc_shattered_hand_scout::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_hor_leader_second::npc_hor_leader_secondAI::DamageTaken(), npc_ice_tomb::npc_ice_tombAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_nightbane::DamageTaken(), boss_thekal::DamageTaken(), npc_garr_firesworn::npc_garr_fireswornAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_kalecgos::boss_kalecgosAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), SmartAI::DamageTaken(), boss_sathrovarr::boss_sathrovarrAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kologarn::boss_kologarnAI::DamageTaken(), boss_kologarn_arms::boss_kologarn_armsAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), DealDamage(), DealMeleeDamage(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), npc_the_scourge_cauldron::npc_the_scourge_cauldronAI::DoDie(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), Spell::EffectHealMaxHealth(), Spell::EffectInstaKill(), Pet::FillPetInfo(), boss_supremus::FindHatefulStrikeTarget(), GetHealthGain(), GetHealthPct(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_rajaxx_thundercrash::HandleDamageCalc(), misc_commandscript::HandleDieCommand(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), npc_commandscript::HandleNpcInfoCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_item_blood_draining_enchant::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), HealthAbovePct(), HealthAbovePctHealed(), HealthBelowPct(), HealthBelowPctDamaged(), IsFullHealth(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied(), npc_dirt_mound::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), Kill(), ModifyHealth(), spell_xt002_gravity_bomb_aura::OnPeriodic(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), Creature::ResetPlayerDamageReq(), Player::SaveHealthBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), SendAttackStateUpdate(), SendSpellNonMeleeDamageLog(), SendSpellNonMeleeReflectLog(), SetMaxHealth(), boss_eadric::boss_eadricAI::SpellHit(), boss_headless_horseman_head::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), boss_ouro::Submerge(), Aura::Update(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), Player::UpdateCharmedAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ GetHealthGain()

int32 Unit::GetHealthGain ( int32  dVal)
14053{
14054 int32 gain = 0;
14055
14056 if (dVal == 0)
14057 return 0;
14058
14059 int32 curHealth = (int32)GetHealth();
14060
14061 int32 val = dVal + curHealth;
14062 if (val <= 0)
14063 {
14064 return -curHealth;
14065 }
14066
14067 int32 maxHealth = (int32)GetMaxHealth();
14068
14069 if (val < maxHealth)
14070 gain = dVal;
14071 else if (curHealth != maxHealth)
14072 gain = maxHealth - curHealth;
14073
14074 return gain;
14075}

References GetHealth(), and GetMaxHealth().

Referenced by Spell::DoAllEffectOnTarget().

◆ GetHealthPct()

◆ getHostileRefMgr()

◆ GetHoverHeight()

float Unit::GetHoverHeight ( ) const
inline

◆ GetInterruptMask()

uint32 Unit::GetInterruptMask ( ) const
inline
1505{ return m_interruptMask; }

References m_interruptMask.

◆ GetLastDamagedTargetGuid()

ObjectGuid const & Unit::GetLastDamagedTargetGuid ( ) const
inline
918{ return _lastDamagedTargetGuid; }

References _lastDamagedTargetGuid.

◆ GetLastExtraAttackSpell()

uint32 Unit::GetLastExtraAttackSpell ( ) const
inline
915{ return _lastExtraAttackSpell; }

References _lastExtraAttackSpell.

Referenced by HandleProcTriggerSpell().

◆ GetLevel()

uint8 Unit::GetLevel ( ) const
inline
@ UNIT_FIELD_LEVEL
Definition: UpdateFields.h:114

References Object::GetUInt32Value(), and UNIT_FIELD_LEVEL.

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDamage(), KillRewarder::_InitGroupData(), Pet::_LoadAuras(), KillRewarder::_RewardPlayer(), KillRewarder::_RewardXP(), Player::_SaveCharacter(), Player::_SaveStats(), spell_pal_ardent_defender::Absorb(), Pet::addSpell(), Spell::AddUnitTarget(), Player::ApplyEnchantment(), AuraEffect::AuraEffect(), BattlegroundMgr::BuildBattlegroundListPacket(), WorldSession::BuildPartyMemberStatsChangedPacket(), CalcArmorReducedDamage(), SpellInfo::CalcPowerCost(), SpellEffectInfo::CalcRadius(), spell_gen_disabled_above_63::CalculateAmount(), spell_item_arcane_shroud::CalculateAmount(), spell_item_the_eye_of_diminution::CalculateAmount(), CalculateLevelPenalty(), CalculateMeleeDamage(), Player::CalculateMinMaxDamage(), Player::CalculateQuestRewardXP(), Player::CalculateReputationGain(), Player::CalculateTalentsPoints(), SpellEffectInfo::CalcValue(), Player::CanEquipItem(), Group::CanJoinBattlegroundQueue(), Player::CanSeeStartQuest(), Player::CanUseItem(), Player::CheckAreaExploreAndOutdoor(), spell_hun_tame_beast::CheckCast(), Spell::CheckCast(), Spell::CheckEffectTarget(), spell_gen_proc_above_75::CheckLevel(), spell_gen_proc_reduced_above_60::CheckProc(), spell_item_green_whelp_armor::CheckProc(), Pet::CreateBaseAtTamed(), Player::CreatePet(), CreateTamedPetFrom(), DealMeleeDamage(), DoLowUnlearnCost(), DoMedUnlearnCost(), Spell::DoSpellHitOnUnit(), Spell::EffectAddHonor(), Spell::EffectApplyGlyph(), Spell::EffectDuel(), Spell::EffectEnergize(), Spell::EffectSchoolDMG(), Spell::EffectSkinning(), Spell::EffectTameCreature(), Pet::FillPetInfo(), lfg::LFGMgr::FinishDungeon(), Acore::XP::Gain(), Player::GetAverageItemLevel(), Player::GetAverageItemLevelForDF(), Player::GetBarberShopCost(), Player::GetBGAccessByLevel(), Pet::GetCurrentFoodBenefitLevel(), npc_wg_quest_giver::GetDialogStatus(), Player::GetDodgeFromAgility(), GetEffectiveResistChance(), SocialMgr::GetFriendInfo(), getLevelForTarget(), Creature::getLevelForTarget(), GetMaxSkillValueForLevel(), Player::GetMeleeCritFromAgility(), Pet::GetNativeObjectScale(), Player::GetQuestDialogStatus(), Player::GetQuestLevel(), Player::GetRatingMultiplier(), Creature::GetShieldBlockValue(), Player::GetSpellCritFromIntellect(), Player::GetsRecruitAFriendBonus(), Player::GetTrainerSpellState(), GetUnitMeleeSkill(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), WorldSession::HandleAcceptGrantLevel(), OutdoorPvPSI::HandleAreaTrigger(), WorldSession::HandleArenaTeamInviteOpcode(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), WorldSession::HandleBattlefieldStatusOpcode(), WorldSession::HandleBattlemasterJoinArena(), WorldSession::HandleBattlemasterJoinOpcode(), WorldSession::HandleCastSpellOpcode(), Player::HandleDrowning(), WorldSession::HandleGrantLevel(), WorldSession::HandleGroupInviteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLfgPlayerLockInfoRequestOpcode(), Guild::HandleMemberDepositMoney(), Guild::HandleMemberWithdrawMoney(), WorldSession::HandleMessagechatOpcode(), npc_commandscript::HandleNpcInfoCommand(), WorldSession::HandleOfferPetitionOpcode(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandlePetitionSignOpcode(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), spell_pri_divine_aegis::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), reset_commandscript::HandleResetLevelCommand(), spell_wintergrasp_portal::HandleScript(), spell_item_scroll_of_recall::HandleScript(), WorldSession::HandleSendMail(), player_settings_commandscript::HandleSettingsAnnouncerFlags(), Player::InitGlyphsForLevel(), lfg::LFGMgr::InitializeLockedDungeons(), Pet::InitLevelupSpellsForLevel(), Puppet::InitStats(), TempSummon::InitStats(), Player::InitStatsForLevel(), Pet::InitTalentForLevel(), Player::InitTaxiNodesForLevel(), Battlefield::InvitePlayerToWar(), Creature::isCanTrainingAndResetTalentsOf(), Player::isHonorOrXPTarget(), Player::IsMaxLevel(), Player::LearnDefaultSkill(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), AchievementCriteriaData::Meets(), MeleeSpellHitResult(), Player::OCTRegenHPPerSpirit(), Player::OCTRegenMPPerSpirit(), spell_item_with_mount_speed::OnApply(), item_generic_limit_chance_above_60::OnCastItemCombatSpell(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), go_evil_book_for_dummies::OnGossipHello(), Player::OnGossipSelect(), QuestApprenticeAnglerPlayerScript::OnPlayerCompleteQuest(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), Player::PrepareGossipMenu(), Player::Regenerate(), Player::RegenerateHealth(), Player::RemovedInsignia(), Pet::removeSpell(), Pet::resetTalents(), Player::ResurrectPlayer(), Player::RewardHonor(), Player::RewardQuest(), RewardRage(), Player::RewardReputation(), RollMeleeOutcomeAgainst(), ArenaTeam::Roster(), Player::Satisfy(), Player::SatisfyQuestLevel(), Pet::SavePetToDB(), CalendarMgr::SendCalendarEvent(), CalendarMgr::SendCalendarEventInvite(), WorldSession::SendLfgPlayerReward(), WorldSession::SendLfgRoleCheckUpdate(), Player::SendLoot(), PlayerMenu::SendQuestGiverOfferReward(), PlayerMenu::SendQuestGiverQuestDetails(), PlayerMenu::SendQuestQueryResponse(), Player::SendQuestReward(), ObjectMgr::SendServerMail(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), Player::SetRestBonus(), Guild::Member::SetStats(), SpellPctDamageModsDone(), Spell::SummonGuardian(), Player::SummonPet(), Pet::SynchronizeLevelWithOwner(), Aura::Update(), npc_pet_hunter_snake_trap::UpdateAI(), Player::UpdateAttackPowerAndDamage(), Player::UpdateCombatSkills(), Creature::UpdateEntry(), lfg::LFGMgr::UpdateRaidBrowser(), and GameObject::Use().

◆ getLevelForTarget()

◆ GetMagicHitRedirectTarget()

Unit * Unit::GetMagicHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo 
)
10955{
10956 // Patch 1.2 notes: Spell Reflection no longer reflects abilities
10957 if (spellInfo->HasAttribute(SPELL_ATTR0_IS_ABILITY) || spellInfo->HasAttribute(SPELL_ATTR1_NO_REDIRECTION) || spellInfo->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES))
10958 return victim;
10959
10961 for (Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
10962 {
10963 if (Unit* magnet = (*itr)->GetBase()->GetUnitOwner())
10964 if (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
10965 //&& spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK
10966 && _IsValidAttackTarget(magnet, spellInfo)
10967 /*&& IsWithinLOSInMap(magnet)*/)
10968 {
10969 // Xinef: We should choose minimum between flight time and queue time as in reflect, however we dont know flight time at this point, use arbitrary small number
10970 magnet->m_Events.AddEvent(new RedirectSpellEvent(*magnet, victim->GetGUID(), *itr), magnet->m_Events.CalculateQueueTime(100));
10971
10972 if (magnet->IsTotem())
10973 {
10974 uint64 queueTime = magnet->m_Events.CalculateQueueTime(100);
10975 if (spellInfo->Speed > 0.0f)
10976 {
10977 float dist = GetDistance(magnet->GetPositionX(), magnet->GetPositionY(), magnet->GetPositionZ());
10978 if (dist < 5.0f)
10979 dist = 5.0f;
10980 queueTime = magnet->m_Events.CalculateTime((uint64)floor(dist / spellInfo->Speed * 1000.0f));
10981 }
10982
10983 magnet->m_Events.AddEvent(new KillMagnetEvent(*magnet), queueTime);
10984 }
10985
10986 return magnet;
10987 }
10988 }
10989 return victim;
10990}
@ SPELL_AURA_SPELL_MAGNET
Definition: SpellAuraDefines.h:159
@ SPELL_ATTR1_NO_REDIRECTION
Definition: SharedDefines.h:422
@ SPELL_ATTR0_IS_ABILITY
Definition: SharedDefines.h:386
Definition: TotemAI.h:48
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
bool _IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell, WorldObject const *obj=nullptr) const
Definition: Unit.cpp:13806
Definition: Unit.h:2007

References _IsValidAttackTarget(), SpellInfo::CheckExplicitTarget(), GetAuraEffectsByType(), WorldObject::GetDistance(), Object::GetGUID(), SpellInfo::HasAttribute(), SpellInfo::Speed, SPELL_ATTR0_IS_ABILITY, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_NO_REDIRECTION, SPELL_AURA_SPELL_MAGNET, and SPELL_CAST_OK.

Referenced by Spell::SelectExplicitTargets().

◆ GetMaxHealth()

uint32 Unit::GetMaxHealth ( ) const
inline
@ UNIT_FIELD_MAXHEALTH
Definition: UpdateFields.h:104

References Object::GetUInt32Value(), and UNIT_FIELD_MAXHEALTH.

Referenced by Player::_SaveStats(), boss_twin_valkyrAI::boss_twin_valkyrAI(), boss_viscidus::boss_viscidus(), WorldSession::BuildPartyMemberStatsChangedPacket(), spell_item_skull_of_impeding_doom::CalculateDamageAmount(), CountPctFromMaxHealth(), boss_eregos::boss_eregosAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_twinemperorsAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_heated_battle::npc_heated_battleAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), Spell::EffectHealMaxHealth(), Spell::EffectSummonPet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), Acore::XP::Gain(), GetHealthGain(), GetHealthPct(), npc_echo_of_medivh::GetPiece(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), HandleAuraProc(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), spell_oculus_soar_aura::HandleEffectPeriodic(), Player::HandleFall(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcInfoCommand(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), npc_echo_of_medivh::HandlePieceJustDied(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_stinky_precious_decimate::HandleScript(), IsFullHealth(), boss_twin_valkyrAI::JustEngagedWith(), boss_sister_svalna::boss_sister_svalnaAI::JustEngagedWith(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPMissingGroupInRange::operator()(), Acore::HealthPctOrderPred::operator()(), Player::outDebugValues(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), Creature::RegenerateHealth(), Player::RegenerateHealth(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_halazzi::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetFullHealth(), SetHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), boss_viscidus::SummonedCreatureDies(), boss_headless_horseman::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxNegativeAuraModifier()

int32 Unit::GetMaxNegativeAuraModifier ( AuraType  auratype) const
5901{
5902 int32 modifier = 0;
5903
5904 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5905 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5906 if ((*i)->GetAmount() < modifier)
5907 modifier = (*i)->GetAmount();
5908
5909 return modifier;
5910}

References GetAuraEffectsByType().

Referenced by AuraEffect::HandlePeriodicHealAurasTick(), SpellHealingBonusTaken(), and UpdateSpeed().

◆ GetMaxNegativeAuraModifierByAffectMask()

int32 Unit::GetMaxNegativeAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6056{
6057 int32 modifier = 0;
6058
6059 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6060 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6061 {
6062 if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() < modifier)
6063 modifier = (*i)->GetAmount();
6064 }
6065
6066 return modifier;
6067}

References GetAuraEffectsByType().

◆ GetMaxNegativeAuraModifierByMiscMask()

int32 Unit::GetMaxNegativeAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5952{
5953 int32 modifier = 0;
5954
5955 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5956 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5957 {
5958 if ((*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() < modifier)
5959 modifier = (*i)->GetAmount();
5960 }
5961
5962 return modifier;
5963}

References GetAuraEffectsByType().

Referenced by SpellTakenCritChance().

◆ GetMaxNegativeAuraModifierByMiscValue()

int32 Unit::GetMaxNegativeAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
6004{
6005 int32 modifier = 0;
6006
6007 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6008 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6009 {
6010 if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() < modifier)
6011 modifier = (*i)->GetAmount();
6012 }
6013
6014 return modifier;
6015}

References GetAuraEffectsByType().

Referenced by MagicSpellHitResult(), and ModSpellDuration().

◆ GetMaxPositiveAuraModifier()

int32 Unit::GetMaxPositiveAuraModifier ( AuraType  auratype)
5887{
5888 int32 modifier = 0;
5889
5890 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5891 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5892 {
5893 if ((*i)->GetAmount() > modifier)
5894 modifier = (*i)->GetAmount();
5895 }
5896
5897 return modifier;
5898}

References GetAuraEffectsByType().

Referenced by CalculateSpellAmount(), AuraEffect::HandlePeriodicHealAurasTick(), Player::RewardHonor(), SpellHealingBonusTaken(), and UpdateSpeed().

◆ GetMaxPositiveAuraModifierByAffectMask()

int32 Unit::GetMaxPositiveAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6042{
6043 int32 modifier = 0;
6044
6045 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6046 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6047 {
6048 if ((*i)->IsAffectedOnSpell(affectedSpell) && (*i)->GetAmount() > modifier)
6049 modifier = (*i)->GetAmount();
6050 }
6051
6052 return modifier;
6053}

References GetAuraEffectsByType().

◆ GetMaxPositiveAuraModifierByMiscMask()

int32 Unit::GetMaxPositiveAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask,
const AuraEffect except = nullptr 
) const
5938{
5939 int32 modifier = 0;
5940
5941 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5942 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5943 {
5944 if (except != (*i) && (*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() > modifier)
5945 modifier = (*i)->GetAmount();
5946 }
5947
5948 return modifier;
5949}

References GetAuraEffectsByType(), and AuraEffect::GetMiscValue().

Referenced by AuraEffect::HandleAuraModResistanceExclusive(), and SpellTakenCritChance().

◆ GetMaxPositiveAuraModifierByMiscValue()

int32 Unit::GetMaxPositiveAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5990{
5991 int32 modifier = 0;
5992
5993 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5994 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5995 {
5996 if ((*i)->GetMiscValue() == misc_value && (*i)->GetAmount() > modifier)
5997 modifier = (*i)->GetAmount();
5998 }
5999
6000 return modifier;
6001}

References GetAuraEffectsByType().

Referenced by MagicSpellHitResult().

◆ GetMaxPower()

uint32 Unit::GetMaxPower ( Powers  power) const
inline
805{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power); }
@ UNIT_FIELD_MAXPOWER1
Definition: UpdateFields.h:105

References Object::GetUInt32Value(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::_SaveStats(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_gen_replenishment_aura::CalculateAmount(), spell_item_skull_of_impeding_doom::CalculateManaLeechAmount(), Spell::CheckItems(), Player::Create(), boss_shade_of_aran::DamageTaken(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectPowerBurn(), Spell::EffectResurrect(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), GetPowerPct(), Player::GiveLevel(), HandleAuraProc(), Aura::HandleAuraSpecificMods(), HandleDummyAuraProc(), modify_commandscript::HandleModifyEnergyCommand(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_hun_ascpect_of_the_viper::HandleProc(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_kelthuzad_detonate_mana_aura::HandleScript(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), boss_curator::JustEngagedWith(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), ModifyPowerPct(), boss_shade_of_aran::OnPowerUpdate(), Acore::PowerPctOrderPred::operator()(), Player::outDebugValues(), spell_item_oracle_ablutions::PrepareSpellScript(), Player::ProcessDelayedOperations(), SmartScript::ProcessEvent(), spell_bronjahm_magic_bane::RecalculateDamage(), Creature::Regenerate(), Player::Regenerate(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), SetPower(), setPowerType(), Player::SummonPet(), boss_selin_fireheart::UpdateAI(), boss_moam::UpdateAI(), boss_faction_championsAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), Player::UpdateCharmedAI(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetMaxSkillValueForLevel()

uint16 Unit::GetMaxSkillValueForLevel ( Unit const *  target = nullptr) const
inline
892{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
uint8 getLevelForTarget(WorldObject const *) const override
Definition: Unit.h:760

References GetLevel(), and getLevelForTarget().

Referenced by Player::GetMaxSkillValueForLevel(), GetUnitCriticalChance(), GetWeaponSkillValue(), isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), and SpellTakenCritChance().

◆ GetMechanicResistChance()

int32 Unit::GetMechanicResistChance ( SpellInfo const *  spell)
3101{
3102 if (!spell)
3103 return 0;
3104 int32 resist_mech = 0;
3105 for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
3106 {
3107 if (!spell->Effects[eff].IsEffect())
3108 break;
3109 int32 effect_mech = spell->GetEffectMechanic(eff);
3110 if (effect_mech)
3111 {
3113 if (resist_mech < temp)
3114 resist_mech = temp;
3115 }
3116 }
3117 return resist_mech;
3118}
@ SPELL_AURA_MOD_MECHANIC_RESISTANCE
Definition: SpellAuraDefines.h:180
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5965

References SpellInfo::Effects, SpellInfo::GetEffectMechanic(), GetTotalAuraModifierByMiscValue(), MAX_SPELL_EFFECTS, and SPELL_AURA_MOD_MECHANIC_RESISTANCE.

Referenced by MagicSpellHitResult(), and MeleeSpellHitResult().

◆ GetMeleeAttackPoint()

bool Unit::GetMeleeAttackPoint ( Unit attacker,
Position pos 
)
2635{
2636 if (!attacker)
2637 {
2638 return false;
2639 }
2640
2641 AttackerSet attackers = getAttackers();
2642
2643 if (attackers.size() <= 1) // if the attackers are not more than one
2644 {
2645 return false;
2646 }
2647
2648 float meleeReach = GetExactDist2d(attacker);
2649 if (meleeReach <= 0)
2650 {
2651 return false;
2652 }
2653
2654 float minAngle = 0;
2655 Unit *refUnit = nullptr;
2656 uint32 validAttackers = 0;
2657
2658 double attackerSize = attacker->GetCollisionRadius();
2659
2660 for (const auto& otherAttacker: attackers)
2661 {
2662 // if the otherAttacker is not valid, skip
2663 if (!otherAttacker || otherAttacker->GetGUID() == attacker->GetGUID() ||
2664 !otherAttacker->IsWithinMeleeRange(this) || otherAttacker->isMoving())
2665 {
2666 continue;
2667 }
2668
2669 float curretAngle = atan(attacker->GetExactDist2d(otherAttacker) / meleeReach);
2670 if (minAngle == 0 || curretAngle < minAngle)
2671 {
2672 minAngle = curretAngle;
2673 refUnit = otherAttacker;
2674 }
2675
2676 validAttackers++;
2677 }
2678
2679 if (!validAttackers || !refUnit)
2680 {
2681 return false;
2682 }
2683
2684 float contactDist = attackerSize + refUnit->GetCollisionRadius();
2685 float requiredAngle = atan(contactDist / meleeReach);
2686 float attackersAngle = atan(attacker->GetExactDist2d(refUnit) / meleeReach);
2687
2688 // in instance: the more attacker there are, the higher will be the tollerance
2689 // outside: creatures should not intersecate
2690 float angleTollerance = attacker->GetMap()->IsDungeon() ? requiredAngle - requiredAngle * tanh(validAttackers / 5.0f) : requiredAngle;
2691
2692 if (attackersAngle > angleTollerance)
2693 {
2694 return false;
2695 }
2696
2697 double angle = atan(contactDist / meleeReach);
2698
2699 float angularRadius = frand(0.1f, 0.3f) + angle;
2700 int8 direction = (urand(0, 1) ? -1 : 1);
2701 float currentAngle = GetAngle(refUnit);
2702 float absAngle = currentAngle + angularRadius * direction;
2703
2704 float x, y, z;
2705 float distance = meleeReach - GetObjectSize();
2706 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle);
2707
2708 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2709 {
2710 GetNearPoint(attacker, x, y, z, distance, 0.0f, absAngle * -1); // try the other side
2711
2712 if (!GetMap()->CanReachPositionAndGetValidCoords(this, x, y, z, true, true))
2713 {
2714 return false;
2715 }
2716 }
2717
2718 pos.Relocate(x, y, z);
2719
2720 return true;
2721}
std::int8_t int8
Definition: Define.h:105
float frand(float min, float max)
Definition: Random.cpp:57
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
Definition: Object.cpp:2623
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:166
float GetCollisionRadius() const override
this method gets the radius of a Unit by DB if any value is defined, otherwise it gets the value by t...
Definition: Unit.cpp:21003
std::unordered_set< Unit * > AttackerSet
Definition: Unit.h:632
AttackerSet const & getAttackers() const
Definition: Unit.h:724
bool IsDungeon() const
Definition: Map.h:448

References frand(), Position::GetAngle(), getAttackers(), GetCollisionRadius(), Position::GetExactDist2d(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetNearPoint(), WorldObject::GetObjectSize(), Map::IsDungeon(), Position::Relocate(), and urand().

Referenced by MotionMaster::MoveCircleTarget().

◆ GetMeleeCritChanceReduction()

float Unit::GetMeleeCritChanceReduction ( ) const
inline

◆ GetMeleeCritDamageReduction()

uint32 Unit::GetMeleeCritDamageReduction ( uint32  damage) const
inline
929{ return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
uint32 GetCombatRatingDamageReduction(CombatRating cr, float rate, float cap, uint32 damage) const
Definition: Unit.cpp:19111

References CR_CRIT_TAKEN_MELEE, and GetCombatRatingDamageReduction().

Referenced by ApplyResilience(), and processDummyAuras().

◆ GetMeleeDamageReduction()

uint32 Unit::GetMeleeDamageReduction ( uint32  damage) const
inline

◆ GetMeleeDamageSchoolMask()

virtual SpellSchoolMask Unit::GetMeleeDamageSchoolMask ( WeaponAttackType  attackType = BASE_ATTACK,
uint8  damageIndex = 0 
) const
pure virtual

Implemented in Player, and Creature.

Referenced by CalculateMeleeDamage().

◆ GetMeleeHitRedirectTarget()

Unit * Unit::GetMeleeHitRedirectTarget ( Unit victim,
SpellInfo const *  spellInfo = nullptr 
)
10993{
10995 for (AuraEffectList::const_iterator i = hitTriggerAuras.begin(); i != hitTriggerAuras.end(); ++i)
10996 {
10997 if (Unit* magnet = (*i)->GetBase()->GetCaster())
10998 if (_IsValidAttackTarget(magnet, spellInfo) && magnet->IsWithinLOSInMap(this)
10999 && (!spellInfo || (spellInfo->CheckExplicitTarget(this, magnet) == SPELL_CAST_OK
11000 && spellInfo->CheckTarget(this, magnet, false) == SPELL_CAST_OK)))
11001 if (roll_chance_i((*i)->GetAmount()))
11002 {
11003 (*i)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
11004 return magnet;
11005 }
11006 }
11007 return victim;
11008}
@ SPELL_AURA_ADD_CASTER_HIT_TRIGGER
Definition: SpellAuraDefines.h:174
bool roll_chance_i(int chance)
Definition: Random.h:59

References _IsValidAttackTarget(), AURA_REMOVE_BY_EXPIRE, SpellInfo::CheckExplicitTarget(), SpellInfo::CheckTarget(), GetAuraEffectsByType(), roll_chance_i(), SPELL_AURA_ADD_CASTER_HIT_TRIGGER, and SPELL_CAST_OK.

Referenced by AttackerStateUpdate(), spell_dk_dancing_rune_weapon::HandleProc(), and Spell::SelectExplicitTargets().

◆ GetMeleeRange()

float Unit::GetMeleeRange ( Unit const *  target) const
681{
682 float range = GetCombatReach() + target->GetCombatReach() + 4.0f / 3.0f;
683 return std::max(range, NOMINAL_MELEE_RANGE);
684}
#define NOMINAL_MELEE_RANGE
Definition: ObjectDefines.h:48
float GetCombatReach() const override
Definition: Unit.h:687

References GetCombatReach(), and NOMINAL_MELEE_RANGE.

Referenced by GetRandomContactPoint(), IsWithinMeleeRange(), CreatureAI::MoveBackwardsChecks(), and SmartScript::ProcessAction().

◆ GetMeleeReach()

float Unit::GetMeleeReach ( ) const
inline
688{ float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; }
#define MIN_MELEE_REACH
Definition: ObjectDefines.h:47

References Object::m_floatValues, MIN_MELEE_REACH, and UNIT_FIELD_COMBATREACH.

Referenced by boss_veknilash::JustEngagedWith(), and npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI().

◆ GetMinionGUID()

ObjectGuid Unit::GetMinionGUID ( ) const
inline
@ UNIT_FIELD_SUMMON
Definition: UpdateFields.h:87

References Object::GetGuidValue(), and UNIT_FIELD_SUMMON.

Referenced by GetFirstControlled(), GetFirstMinion(), and OutDebugInfo().

◆ GetModelForForm()

uint32 Unit::GetModelForForm ( ShapeshiftForm  form,
uint32  spellId 
) const
19118{
19119 // Hardcoded cases
19120 switch (spellId)
19121 {
19122 case 7090: // Bear form
19123 return 29414;
19124 case 35200: // Roc form
19125 return 4877;
19126 default:
19127 break;
19128 }
19129
19130 if (IsPlayer())
19131 {
19132 switch (form)
19133 {
19134 case FORM_CAT:
19135 // Based on Hair color
19136 if (getRace() == RACE_NIGHTELF)
19137 {
19138 uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
19139 switch (hairColor)
19140 {
19141 case 7: // Violet
19142 case 8:
19143 return 29405;
19144 case 3: // Light Blue
19145 return 29406;
19146 case 0: // Green
19147 case 1: // Light Green
19148 case 2: // Dark Green
19149 return 29407;
19150 case 4: // White
19151 return 29408;
19152 default: // original - Dark Blue
19153 return 892;
19154 }
19155 }
19156 // Based on Skin color
19157 else if (getRace() == RACE_TAUREN)
19158 {
19159 uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
19160 // Male
19161 if (getGender() == GENDER_MALE)
19162 {
19163 switch (skinColor)
19164 {
19165 case 12: // White
19166 case 13:
19167 case 14:
19168 case 18: // Completly White
19169 return 29409;
19170 case 9: // Light Brown
19171 case 10:
19172 case 11:
19173 return 29410;
19174 case 6: // Brown
19175 case 7:
19176 case 8:
19177 return 29411;
19178 case 0: // Dark
19179 case 1:
19180 case 2:
19181 case 3: // Dark Grey
19182 case 4:
19183 case 5:
19184 return 29412;
19185 default: // original - Grey
19186 return 8571;
19187 }
19188 }
19189 // Female
19190 else switch (skinColor)
19191 {
19192 case 10: // White
19193 return 29409;
19194 case 6: // Light Brown
19195 case 7:
19196 return 29410;
19197 case 4: // Brown
19198 case 5:
19199 return 29411;
19200 case 0: // Dark
19201 case 1:
19202 case 2:
19203 case 3:
19204 return 29412;
19205 default: // original - Grey
19206 return 8571;
19207 }
19208 }
19210 return 892;
19211 else
19212 return 8571;
19213 case FORM_DIREBEAR:
19214 case FORM_BEAR:
19215 // Based on Hair color
19216 if (getRace() == RACE_NIGHTELF)
19217 {
19218 uint8 hairColor = GetByteValue(PLAYER_BYTES, 3);
19219 switch (hairColor)
19220 {
19221 case 0: // Green
19222 case 1: // Light Green
19223 case 2: // Dark Green
19224 return 29413; // 29415?
19225 case 6: // Dark Blue
19226 return 29414;
19227 case 4: // White
19228 return 29416;
19229 case 3: // Light Blue
19230 return 29417;
19231 default: // original - Violet
19232 return 2281;
19233 }
19234 }
19235 // Based on Skin color
19236 else if (getRace() == RACE_TAUREN)
19237 {
19238 uint8 skinColor = GetByteValue(PLAYER_BYTES, 0);
19239 // Male
19240 if (getGender() == GENDER_MALE)
19241 {
19242 switch (skinColor)
19243 {
19244 case 0: // Dark (Black)
19245 case 1:
19246 case 2:
19247 return 29418;
19248 case 3: // White
19249 case 4:
19250 case 5:
19251 case 12:
19252 case 13:
19253 case 14:
19254 return 29419;
19255 case 9: // Light Brown/Grey
19256 case 10:
19257 case 11:
19258 case 15:
19259 case 16:
19260 case 17:
19261 return 29420;
19262 case 18: // Completly White
19263 return 29421;
19264 default: // original - Brown
19265 return 2289;
19266 }
19267 }
19268 // Female
19269 else switch (skinColor)
19270 {
19271 case 0: // Dark (Black)
19272 case 1:
19273 return 29418;
19274 case 2: // White
19275 case 3:
19276 return 29419;
19277 case 6: // Light Brown/Grey
19278 case 7:
19279 case 8:
19280 case 9:
19281 return 29420;
19282 case 10: // Completly White
19283 return 29421;
19284 default: // original - Brown
19285 return 2289;
19286 }
19287 }
19289 return 2281;
19290 else
19291 return 2289;
19292 case FORM_FLIGHT:
19294 return 20857;
19295 return 20872;
19296 case FORM_FLIGHT_EPIC:
19298 return 21243;
19299 return 21244;
19300 default:
19301 break;
19302 }
19303 }
19304
19305 uint32 modelid = 0;
19306 SpellShapeshiftFormEntry const* formEntry = sSpellShapeshiftFormStore.LookupEntry(form);
19307 if (formEntry && formEntry->modelID_A)
19308 {
19309 // Take the alliance modelid as default
19310 if (GetTypeId() != TYPEID_PLAYER)
19311 return formEntry->modelID_A;
19312 else
19313 {
19315 modelid = formEntry->modelID_A;
19316 else
19317 modelid = formEntry->modelID_H;
19318
19319 // If the player is horde but there are no values for the horde modelid - take the alliance modelid
19320 if (!modelid && Player::TeamIdForRace(getRace()) == TEAM_HORDE)
19321 modelid = formEntry->modelID_A;
19322 }
19323 }
19324
19325 return modelid;
19326}
@ PLAYER_BYTES
Definition: UpdateFields.h:181
@ FORM_DIREBEAR
Definition: UnitDefines.h:77
@ FORM_FLIGHT_EPIC
Definition: UnitDefines.h:94
@ FORM_CAT
Definition: UnitDefines.h:70
@ FORM_FLIGHT
Definition: UnitDefines.h:96
@ FORM_BEAR
Definition: UnitDefines.h:74
@ GENDER_MALE
Definition: SharedDefines.h:61
@ RACE_NIGHTELF
Definition: SharedDefines.h:74
@ RACE_TAUREN
Definition: SharedDefines.h:76
@ TEAM_ALLIANCE
Definition: SharedDefines.h:760
@ TEAM_HORDE
Definition: SharedDefines.h:761
static TeamId TeamIdForRace(uint8 race)
Definition: Player.cpp:5786
uint8 getGender() const
Definition: Unit.h:768
uint8 getRace(bool original=false) const
Definition: Unit.cpp:20909
uint32 modelID_H
Definition: DBCStructure.h:1827
uint32 modelID_A
Definition: DBCStructure.h:1826

References FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_FLIGHT, FORM_FLIGHT_EPIC, GENDER_MALE, Object::GetByteValue(), getGender(), getRace(), Object::GetTypeId(), Object::IsPlayer(), SpellShapeshiftFormEntry::modelID_A, SpellShapeshiftFormEntry::modelID_H, PLAYER_BYTES, RACE_NIGHTELF, RACE_TAUREN, sSpellShapeshiftFormStore, TEAM_ALLIANCE, TEAM_HORDE, Player::TeamIdForRace(), and TYPEID_PLAYER.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), and RestoreDisplayId().

◆ GetModelForTotem()

uint32 Unit::GetModelForTotem ( PlayerTotemType  totemType)
19329{
19330 switch (getRace())
19331 {
19332 case RACE_ORC:
19333 {
19334 switch (totemType)
19335 {
19336 case SUMMON_TYPE_TOTEM_FIRE: // fire
19337 return 30758;
19338 case SUMMON_TYPE_TOTEM_EARTH: // earth
19339 return 30757;
19340 case SUMMON_TYPE_TOTEM_WATER: // water
19341 return 30759;
19342 case SUMMON_TYPE_TOTEM_AIR: // air
19343 return 30756;
19344 }
19345 break;
19346 }
19347 case RACE_DWARF:
19348 {
19349 switch (totemType)
19350 {
19351 case SUMMON_TYPE_TOTEM_FIRE: // fire
19352 return 30754;
19353 case SUMMON_TYPE_TOTEM_EARTH: // earth
19354 return 30753;
19355 case SUMMON_TYPE_TOTEM_WATER: // water
19356 return 30755;
19357 case SUMMON_TYPE_TOTEM_AIR: // air
19358 return 30736;
19359 }
19360 break;
19361 }
19362 case RACE_TROLL:
19363 {
19364 switch (totemType)
19365 {
19366 case SUMMON_TYPE_TOTEM_FIRE: // fire
19367 return 30762;
19368 case SUMMON_TYPE_TOTEM_EARTH: // earth
19369 return 30761;
19370 case SUMMON_TYPE_TOTEM_WATER: // water
19371 return 30763;
19372 case SUMMON_TYPE_TOTEM_AIR: // air
19373 return 30760;
19374 }
19375 break;
19376 }
19377 case RACE_TAUREN:
19378 {
19379 switch (totemType)
19380 {
19381 case SUMMON_TYPE_TOTEM_FIRE: // fire
19382 return 4589;
19383 case SUMMON_TYPE_TOTEM_EARTH: // earth
19384 return 4588;
19385 case SUMMON_TYPE_TOTEM_WATER: // water
19386 return 4587;
19387 case SUMMON_TYPE_TOTEM_AIR: // air
19388 return 4590;
19389 }
19390 break;
19391 }
19392 case RACE_DRAENEI:
19393 {
19394 switch (totemType)
19395 {
19396 case SUMMON_TYPE_TOTEM_FIRE: // fire
19397 return 19074;
19398 case SUMMON_TYPE_TOTEM_EARTH: // earth
19399 return 19073;
19400 case SUMMON_TYPE_TOTEM_WATER: // water
19401 return 19075;
19402 case SUMMON_TYPE_TOTEM_AIR: // air
19403 return 19071;
19404 }
19405 break;
19406 }
19407 default: // One standard for other races.
19408 {
19409 switch (totemType)
19410 {
19411 case SUMMON_TYPE_TOTEM_FIRE: // fire
19412 return 4589;
19413 case SUMMON_TYPE_TOTEM_EARTH: // earth
19414 return 4588;
19415 case SUMMON_TYPE_TOTEM_WATER: // water
19416 return 4587;
19417 case SUMMON_TYPE_TOTEM_AIR: // air
19418 return 4590;
19419 }
19420 break;
19421 }
19422 }
19423 return 0;
19424}
@ SUMMON_TYPE_TOTEM_EARTH
Definition: Unit.h:608
@ SUMMON_TYPE_TOTEM_WATER
Definition: Unit.h:609
@ SUMMON_TYPE_TOTEM_FIRE
Definition: Unit.h:607
@ SUMMON_TYPE_TOTEM_AIR
Definition: Unit.h:610
@ RACE_TROLL
Definition: SharedDefines.h:78
@ RACE_ORC
Definition: SharedDefines.h:72
@ RACE_DRAENEI
Definition: SharedDefines.h:81
@ RACE_DWARF
Definition: SharedDefines.h:73

References getRace(), RACE_DRAENEI, RACE_DWARF, RACE_ORC, RACE_TAUREN, RACE_TROLL, SUMMON_TYPE_TOTEM_AIR, SUMMON_TYPE_TOTEM_EARTH, SUMMON_TYPE_TOTEM_FIRE, and SUMMON_TYPE_TOTEM_WATER.

◆ GetModifierValue()

float Unit::GetModifierValue ( UnitMods  unitMod,
UnitModifierType  modifierType 
) const
15216{
15217 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
15218 {
15219 LOG_ERROR("entities.unit", "attempt to access non-existing modifier value from UnitMods!");
15220 return 0.0f;
15221 }
15222
15223 if (modifierType == TOTAL_PCT && m_auraModifiersGroup[unitMod][modifierType] <= 0.0f)
15224 return 0.0f;
15225
15226 return m_auraModifiersGroup[unitMod][modifierType];
15227}
@ MODIFIER_TYPE_END
Definition: Unit.h:130

References LOG_ERROR, m_auraModifiersGroup, MODIFIER_TYPE_END, TOTAL_PCT, and UNIT_MOD_END.

Referenced by Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectWeaponDmg(), Guardian::UpdateArmor(), Player::UpdateArmor(), Creature::UpdateAttackPowerAndDamage(), Guardian::UpdateAttackPowerAndDamage(), Player::UpdateAttackPowerAndDamage(), Guardian::UpdateDamagePhysical(), Guardian::UpdateMaxHealth(), Player::UpdateMaxHealth(), Guardian::UpdateMaxPower(), Player::UpdateMaxPower(), and Player::UpdateResistances().

◆ GetMotionMaster() [1/2]

MotionMaster * Unit::GetMotionMaster ( )
inline
1605{ return i_motionMaster; }

References i_motionMaster.

Referenced by _ExitVehicle(), HomeMovementGenerator< Creature >::_setTargetLocation(), PetAI::_stopAttack(), BattlegroundAV::AddAVCreature(), npc_mograine::npc_mograineAI::AshbringerEvent(), UnitAI::AttackStart(), FollowerAI::AttackStart(), boss_priestess_lackey_commonAI::AttackStart(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::AttackStart(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::AttackStart(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::AttackStart(), boss_malygos::boss_malygosAI::AttackStart(), npc_nexus_lord::npc_nexus_lordAI::AttackStart(), boss_illidan_stormrage::boss_illidan_stormrageAI::AttackStart(), boss_swamplord_muselek::AttackStart(), ArcherAI::AttackStart(), npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_shade_of_aran::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), npc_hyjal_ground_trash::AttackStart(), npc_hyjal_gargoyle::AttackStart(), npc_hyjal_frost_wyrm::AttackStart(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::AttackStart(), boss_magus_telestra::boss_magus_telestraAI::AttackStart(), boss_razorscale::boss_razorscaleAI::AttackStart(), boss_high_nethermancer_zerevor::AttackStart(), boss_lady_malande::AttackStart(), boss_olm_the_summoner::AttackStart(), boss_kiggler_the_crazed::AttackStart(), boss_krosh_firehand::AttackStart(), npc_millhouse_manastorm::npc_millhouse_manastormAI::AttackStart(), boss_high_astromancer_solarian::AttackStart(), npc_capernian::AttackStart(), UnitAI::AttackStartCaster(), boss_professor_putricide::boss_professor_putricideAI::ChangePhase(), CleanupBeforeRemoveFromMap(), boss_isalien::DamageTaken(), boss_julianne::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_leotheras_the_blind::DemonTime(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_nightbane::DoAction(), npc_apothecary_genericAI::DoAction(), npc_chained_spirit::DoAction(), boss_anetheron::DoAction(), boss_azgalor::DoAction(), boss_kazrogal::DoAction(), boss_rage_winterchill::DoAction(), npc_hyjal_ground_trash::DoAction(), npc_hyjal_gargoyle::DoAction(), npc_hyjal_frost_wyrm::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_saurfang_event::npc_saurfang_eventAI::DoAction(), boss_professor_putricide::boss_professor_putricideAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_argent_captainAI::DoAction(), npc_icc_spire_frostwyrm::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::DoAction(), npc_ahune_bunny::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_living_mojo::npc_living_mojoAI::DoAction(), npc_power_spark::npc_power_sparkAI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), boss_skadi::boss_skadiAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), boss_ambassador_hellmaw::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), npc_akama_shade::DoAction(), boss_nazan::DoAction(), boss_ghazan::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), PetAI::DoAttack(), Creature::DoFleeToGetAssistance(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoStartMovement(), ScriptedAI::DoStartNoMovement(), go_commandscript::DoTeleport(), Spell::EffectCharge(), Spell::EffectChargeDest(), Spell::EffectDistract(), Spell::EffectJump(), Spell::EffectJumpDest(), Spell::EffectPullTowards(), Spell::EffectSummonType(), boss_jindo::EnterEvadeMode(), npc_black_morass_summoned_add::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), npc_argent_captainAI::EnterEvadeMode(), CreatureAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), npc_burning_spirit::npc_burning_spiritAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_mrfloppy::npc_mrfloppyAI::EnterEvadeMode(), npc_pet_gen_argent_pony_bridle::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), boss_halazzi::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), VehicleDespawnEvent::Execute(), RestoreAttack::Execute(), OrcMoveEvent::Execute(), NpcRunToHome::Execute(), UtherBatteredHiltEvent::Execute(), SlaveRunEvent::Execute(), DelayedMovementEvent::Execute(), DaranavanMoveEvent::Execute(), FrostwyrmLandEvent::Execute(), SACActivateEvent::Execute(), AssistanceMovementGenerator::Finalize(), npc_dark_iron_guzzler::FindNextKeg(), npc_hallows_end_soh::FinishEvent(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_nightbane::FlyToClosestPreFlyWayPoint(), Creature::FocusTarget(), CreatureGroup::FormationReset(), boss_volkhan::boss_volkhanAI::GoToAnvil(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_apothecary_lingering_fumes::HandleAfterCast(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), misc_commandscript::HandleAppearCommand(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), misc_commandscript::HandleComeToMeCommand(), spell_q12589_shoot_rjr::HandleDummy(), spell_q11520_discovering_your_roots::HandleDummy(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_icc_geist_alarm::HandleEvent(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), go_commandscript::HandleGoGraveyardCommand(), go_commandscript::HandleGoGridCommand(), go_commandscript::HandleGoTicketCommand(), go_commandscript::HandleGoZoneXYCommand(), misc_commandscript::HandleGroupSummonCommand(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), spell_item_toxic_wasteling::HandleJump(), AuraEffect::HandleModPossessPet(), misc_commandscript::HandleMovegensCommand(), WorldSession::HandleMoveTeleportAck(), WorldSession::HandleMoveWorldportAck(), npc_commandscript::HandleNpcFollowCommand(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), npc_commandscript::HandleNpcUnFollowCommand(), spell_item_enchanted_broom_periodic::HandlePeriodicTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), spell_entropius_black_hole_effect::HandlePull(), spell_boss_magus_telestra_gravity_well::HandlePull(), PetAI::HandleReturnMovement(), spell_the_lich_king_valkyr_target_search::HandleScript(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), spell_gen_ayamiss_swarmer_loop::HandleScript(), WorldSession::HandleSetRaidDifficultyOpcode(), spell_sindragosa_icy_grip_jump::HandleSpecial(), spell_item_draenic_pale_ale::HandleSummon(), tele_commandscript::HandleTeleCommand(), tele_commandscript::HandleTeleGroupCommand(), wp_commandscript::HandleWpLoadCommand(), wp_commandscript::HandleWpUnLoadCommand(), boss_captain_skarloc::InitializeAI(), boss_lieutenant_drake::InitializeAI(), boss_glob_of_viscidus::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), boss_eck::boss_eckAI::InitializeAI(), npc_preparations_for_war_vehicle::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), boss_grand_warlock_nethekurse::IntroRP(), Creature::IsFreeToMove(), IsMutualChase(), boss_gahzranka::boss_gahzrankaAI::IsSummonedBy(), boss_aeonus::IsSummonedBy(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::IsSummonedBy(), npc_burning_spirit::npc_burning_spiritAI::IsSummonedBy(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::IsSummonedBy(), npc_spirit_shade::npc_spirit_shadeAI::IsSummonedBy(), JumpTo(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), boss_ayamiss::JustDied(), npc_cyclone::JustEngagedWith(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_grandmaster_vorpil::JustEngagedWith(), boss_warlord_kalithresh::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_nazan::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_ayamiss::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_alar::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), SmartAI::JustReachedHome(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), boss_ghazan::JustReachedHome(), boss_grand_warlock_nethekurse::JustReachedHome(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_auriaya::boss_auriayaAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), npc_daphne_stilwell::npc_daphne_stilwellAI::JustSummoned(), boss_mekgineer_steamrigger::JustSummoned(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_xevozz::boss_xevozzAI::JustSummoned(), npc_hor_lich_king::npc_hor_lich_kingAI::JustSummoned(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::JustSummoned(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_vexallus::JustSummoned(), npc_kalecgos_kj::npc_kalecgos_kjAI::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::JustSummoned(), npc_medivh_bm::JustSummoned(), boss_hadronox::boss_hadronoxAI::JustSummoned(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_akama_shade::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_hydross_the_unstable::JustSummoned(), boss_lady_vashj::JustSummoned(), boss_mennu_the_betrayer::JustSummoned(), boss_kaelthas::JustSummoned(), boss_mechano_lord_capacitus::JustSummoned(), npc_rinji::npc_rinjiAI::JustSummoned(), npc_maghar_captive::npc_maghar_captiveAI::JustSummoned(), boss_ayamiss::JustSummoned(), Player::KillPlayer(), KnockbackFrom(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderMoveTo(), Player::LeaveBattleground(), Creature::Motion_Initialize(), SmartAI::MoveAway(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), PetAI::MovementInform(), boss_ebonroc::boss_ebonrocAI::MovementInform(), boss_nightbane::MovementInform(), boss_bug_trio::MovementInform(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_four_horsemen::boss_four_horsemenAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), npc_fel_guard_hound::npc_fel_guard_houndAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_cameron::MoveTheChildren(), boss_four_horsemen::boss_four_horsemenAI::MoveToCorner(), npc_concentrated_ball::npc_concentrated_ballAI::MoveToNextPoint(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_leotheras_the_blind::MoveToTargetIfOutOfRange(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), NearTeleportTo(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_collapsing_star::npc_collapsing_starAI::npc_collapsing_starAI(), npc_frost_sphere::npc_frost_sphereAI::npc_frost_sphereAI(), npc_omen::npc_omenAI::npc_omenAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::npc_pos_after_first_bossAI(), npc_ulduar_saronite_vapors::npc_ulduar_saronite_vaporsAI::npc_ulduar_saronite_vaporsAI(), spell_halion_twilight_phasing_aura::OnApply(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_hyjal_jaina::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_kernobee::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnRemove(), spell_halion_twilight_phasing_aura::OnRemove(), SplineHandler::operator()(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded(), npc_vics_flying_machine::npc_vics_flying_machineAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nightbane::PathEndReached(), boss_anetheron::PathEndReached(), boss_rage_winterchill::PathEndReached(), npc_hyjal_ground_trash::PathEndReached(), npc_hyjal_frost_wyrm::PathEndReached(), boss_ambassador_hellmaw::PathEndReached(), boss_nefarian::PathEndReached(), npc_hyjal_gargoyle::PathEndReached(), PauseMovement(), SmartAI::PausePath(), PetSpellFail(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::PickNewLocation(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), propagateSpeedChange(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), RemoveCharmedBy(), boss_the_beast::boss_thebeastAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_kalec::boss_kalecAI::Reset(), npc_janalai_hatchling::npc_janalai_hatchlingAI::Reset(), boss_arlokk::boss_arlokkAI::Reset(), npc_zulian_prowler::npc_zulian_prowlerAI::Reset(), npc_batrider::Reset(), npc_brew_bubble::Reset(), boss_archimonde::Reset(), boss_ayamiss::Reset(), boss_bug_trio::Reset(), boss_jedoga_shadowseeker::Reset(), npc_kinetic_bomb::npc_kinetic_bombAI::Reset(), npc_assembly_lightning::npc_assembly_lightningAI::Reset(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_released_offspring_harkoa::npc_released_offspring_harkoaAI::Reset(), npc_voidtraveler::Reset(), boss_lady_vashj::Reset(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_infernal_attacker::npc_infernal_attackerAI::Reset(), npc_pet_gen_gnomish_flame_turret::Reset(), Creature::Respawn(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), ResumeMovement(), SmartAI::ResumePath(), Resurrect(), SmartAI::ReturnToLastOOCPos(), npc_escortAI::ReturnToLastPoint(), boss_magtheridon::ScheduleCombatEvents(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), boss_nightbane::ScheduleLand(), boss_laj::ScheduleTasks(), boss_selin_fireheart::SelectNearestCrystal(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), WorldSession::SendDoFlight(), boss_sartharion::boss_sartharionAI::SendLavaWaves(), SetCharmedBy(), SmartAI::SetCombatMove(), SetConfused(), boss_grand_warlock_nethekurse::SetData(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::SetData(), gunship_npc_AI::SetData(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_eastvale_peasent::SetData(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::SetData(), setDeathState(), Creature::setDeathState(), SetFeared(), SmartAI::SetFollow(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::SetGUID(), SetInCombatState(), Player::SetMover(), SetSpeed(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), npc_akama_shade::sGossipSelect(), boss_thorim::boss_thorimAI::SpawnArenaNPCs(), npc_varian_wrynn::npc_varian_wrynnAI::SpawnWave(), npc_thrall_bfu::npc_thrall_bfuAI::SpawnWave(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::SpellHit(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::SpellHit(), npc_saurfang_event::npc_saurfang_eventAI::SpellHit(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_death_knight_initiate::npc_death_knight_initiateAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_forest_frog::npc_forest_frogAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::SpellHit(), npc_iron_watcher::npc_iron_watcherAI::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_chesspiece::SpellHitTarget(), npc_pet_gen_fetch_ball::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_escortAI::Start(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), FollowerAI::StartFollow(), WaypointMovementGenerator< Creature >::StartMove(), npc_stillpine_capitive::npc_stillpine_capitiveAI::StartMoving(), SmartAI::StartPath(), SmartAI::StopFollow(), SmartAI::StopPath(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_vazruden_the_herald::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), Spell::SummonGuardian(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave(), Player::TeleportTo(), CreatureAI::TriggerAlert(), Pet::Update(), Update(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_gyth::boss_gythAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_felblood_kaelthas::UpdateAI(), boss_selin_fireheart::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_cameron::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_grand_magister_rommath::npc_grand_magister_rommathAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_akilzon_eagle::npc_akilzon_eagleAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), npc_janalai_hatcher::npc_janalai_hatcherAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_elder_kekek::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), npc_twilight_volunteer::UpdateAI(), npc_taldaram_flamesphere::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_pos_after_first_boss::npc_pos_after_first_bossAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_leader_second::npc_pos_leader_secondAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::UpdateAI(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_emergency_fire_bot::npc_ulduar_emergency_fire_botAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skadi_grauf::boss_skadi_graufAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_conversing_with_the_depths_trigger::npc_conversing_with_the_depths_triggerAI::UpdateAI(), npc_wintergarde_gryphon::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_venture_co_straggler::npc_venture_co_stragglerAI::UpdateAI(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_fel_guard_hound::npc_fel_guard_houndAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_pet_gen_toxic_wasteling::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_demonic_vapor::npc_demonic_vaporAI::UpdateAI(), npc_batrider::UpdateAI(), npc_concentrated_ball::npc_concentrated_ballAI::UpdateAI(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::UpdateAI(), npc_xt002_boombot::npc_xt002_boombotAI::UpdateAI(), Player::UpdateCharmedAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_emily::npc_emilyAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ GetMotionMaster() [2/2]

const MotionMaster * Unit::GetMotionMaster ( ) const
inline
1606{ return i_motionMaster; }

References i_motionMaster.

◆ GetMountID()

◆ GetNativeDisplayId()

◆ GetNativeObjectScale()

virtual float Unit::GetNativeObjectScale ( ) const
inlinevirtual

Reimplemented in Creature, and Pet.

1509{ return 1.0f; }

Referenced by RecalculateObjectScale().

◆ GetNegStat()

float Unit::GetNegStat ( Stats  stat) const
inline
1387{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_NEGSTAT0.

◆ GetNextRandomRaidMemberOrPet()

Unit * Unit::GetNextRandomRaidMemberOrPet ( float  radius)
11050{
11051 Player* player = nullptr;
11052 if (IsPlayer())
11053 player = ToPlayer();
11054 // Should we enable this also for charmed units?
11055 else if (GetTypeId() == TYPEID_UNIT && IsPet())
11056 player = GetOwner()->ToPlayer();
11057
11058 if (!player)
11059 return nullptr;
11060 Group* group = player->GetGroup();
11061 // When there is no group check pet presence
11062 if (!group)
11063 {
11064 // We are pet now, return owner
11065 if (player != this)
11066 return IsWithinDistInMap(player, radius) ? player : nullptr;
11067 Unit* pet = GetGuardianPet();
11068 // No pet, no group, nothing to return
11069 if (!pet)
11070 return nullptr;
11071 // We are owner now, return pet
11072 return IsWithinDistInMap(pet, radius) ? pet : nullptr;
11073 }
11074
11075 std::vector<Unit*> nearMembers;
11076 // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then)
11077 nearMembers.reserve(group->GetMembersCount() * 2);
11078
11079 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
11080 if (Player* Target = itr->GetSource())
11081 {
11082 if (Target != this && !IsWithinDistInMap(Target, radius))
11083 continue;
11084
11085 // IsHostileTo check duel and controlled by enemy
11086 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
11087 nearMembers.push_back(Target);
11088
11089 // Push player's pet to vector
11090 if (Unit* pet = Target->GetGuardianPet())
11091 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
11092 nearMembers.push_back(pet);
11093 }
11094
11095 if (nearMembers.empty())
11096 return nullptr;
11097
11098 uint32 randTarget = urand(0, nearMembers.size() - 1);
11099 return nearMembers[randTarget];
11100}
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
Definition: Object.cpp:1321
Group * GetGroup()
Definition: Player.h:2444
Guardian * GetGuardianPet() const
Definition: Unit.cpp:10591
Definition: Group.h:169
uint32 GetMembersCount() const
Definition: Group.h:245
GroupReference * GetFirstMember()
Definition: Group.h:243
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36

References Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), Group::GetMembersCount(), GetOwner(), Object::GetTypeId(), IsHostileTo(), IsPet(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), GroupReference::next(), Object::ToPlayer(), TYPEID_UNIT, and urand().

Referenced by HandleAuraRaidProcFromCharge(), and AuraEffect::HandleRaidProcFromChargeAuraProc().

◆ GetNpcFlags()

◆ GetOldFactionId()

uint32 Unit::GetOldFactionId ( ) const
inline
1807{ return _oldFactionId; }

References _oldFactionId.

Referenced by npc_chesspiece::OnCharmed().

◆ GetOwnedAura()

Aura * Unit::GetOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
Aura except = nullptr 
) const
4723{
4724 AuraMapBounds range = m_ownedAuras.equal_range(spellId);
4725 for (AuraMap::const_iterator itr = range.first; itr != range.second; ++itr)
4726 {
4727 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask)
4728 && (!casterGUID || itr->second->GetCasterGUID() == casterGUID)
4729 && (!itemCasterGUID || itr->second->GetCastItemGUID() == itemCasterGUID)
4730 && (!except || except != itr->second))
4731 {
4732 return itr->second;
4733 }
4734 }
4735 return nullptr;
4736}
std::pair< AuraMap::const_iterator, AuraMap::const_iterator > AuraMapBounds
Definition: Unit.h:636

References m_ownedAuras.

Referenced by _TryStackingOrRefreshingExistingAura().

◆ GetOwnedAuras() [1/2]

◆ GetOwnedAuras() [2/2]

AuraMap const & Unit::GetOwnedAuras ( ) const
inline
1258{ return m_ownedAuras; }

References m_ownedAuras.

◆ GetOwner()

Unit * Unit::GetOwner ( ) const
10541{
10542 if (ObjectGuid ownerGUID = GetOwnerGUID())
10543 return ObjectAccessor::GetUnit(*this, ownerGUID);
10544
10545 return nullptr;
10546}

References GetOwnerGUID(), and ObjectAccessor::GetUnit().

Referenced by _ExitVehicle(), Acore::AnyAoETargetUnitInObjectRangeCheck::AnyAoETargetUnitInObjectRangeCheck(), ApplyDiminishingToDuration(), ApplyResilience(), TotemAI::AttackStart(), spell_dk_anti_magic_zone::CalculateAmount(), Creature::CanStartAttack(), spell_dk_blood_gorged::CheckProc(), spell_pri_mana_leech::CheckProc(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealHeal(), HostileRefMgr::deleteReferences(), npc_spring_rabbit::npc_spring_rabbitAI::DoAction(), Spell::DoAllEffectOnLaunchTarget(), Spell::DoAllEffectOnTarget(), PetAI::DoAttack(), Spell::EffectDispel(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), boss_illidari_council_memberAI::EnterEvadeMode(), GetCharmerOrOwner(), GetCombatRatingReduction(), GetNextRandomRaidMemberOrPet(), GetReactionTo(), GetSpellModOwner(), spell_warl_seduction::HandleAuraApply(), HandleAuraRaidProcFromChargeWithValue(), Aura::HandleAuraSpecificMods(), spell_sha_healing_stream_totem::HandleDummy(), spell_q12277_wintergarde_mine_explosion::HandleDummy(), spell_sha_mana_tide_totem::HandleDummy(), HandleDummyAuraProc(), spell_mount_check_aura::HandleEffectPeriodic(), spell_gen_gryphon_wyvern_mount_check::HandleEffectPeriodic(), spell_ioc_bomb_blast_criteria::HandleGameObjectDamage(), modify_commandscript::HandleModifyTalentCommand(), WorldSession::HandlePetActionHelper(), spell_warl_demonic_pact_aura::HandleProc(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::InitializeAI(), npc_pet_dk_dancing_rune_weapon::npc_pet_dk_dancing_rune_weaponAI::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), IsAlwaysVisibleFor(), IsPetAura(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::JustDied(), Kill(), MagicSpellHitResult(), MeleeDamageBonusDone(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), npc_khunok_the_behemoth::npc_khunok_the_behemothAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), spell_hun_aspect_of_the_beast::OnPetApply(), Acore::MostHPMissingGroupInRange::operator()(), PetSpellFail(), RemoveFromWorld(), npc_target_dummy::npc_target_dummyAI::Reset(), npc_spring_rabbit::npc_spring_rabbitAI::Reset(), RestoreFaction(), Creature::SelectVictim(), SendPetActionFeedback(), SendPetAIReaction(), SendPetTalk(), SetHealth(), SetMaxHealth(), SetMaxPower(), SetPower(), setPowerType(), SetStunned(), SpellDamageBonusDone(), SpellHealingBonusDone(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), SpellPctDamageModsDone(), SpellPctHealingModsDone(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), npc_pet_gen_wind_rider_cub::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and UpdateAuraForGroup().

◆ GetOwnerGUID()

ObjectGuid Unit::GetOwnerGUID ( ) const
inline
@ UNIT_FIELD_SUMMONEDBY
Definition: UpdateFields.h:90

References Object::GetGuidValue(), and UNIT_FIELD_SUMMONEDBY.

Referenced by Pet::AddToWorld(), npc_living_mojo::npc_living_mojoAI::AttackStart(), BuildValuesUpdate(), PetAI::CanAttack(), CanFreeMove(), CanHaveThreatList(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), DealDamage(), Spell::DoAllEffectOnTarget(), FollowMovementGenerator< T >::DoUpdate(), GetCharmerOrOwnerGUID(), GetOwner(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModStealthLevel(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetRename(), HandleSpellClick(), Creature::HasMechanicTemplateImmunity(), Creature::IsDungeonBoss(), Creature::IsImmuneToKnockback(), isInAccessiblePlaceFor(), Kill(), Creature::LoadSpellTemplateImmunity(), Condition::Meets(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_venomhide_hatchling::OnGossipHello(), Acore::MostHPMissingGroupInRange::operator()(), PlayerOrPetCheck::operator()(), OutDebugInfo(), PetAI::ReceiveEmote(), Creature::Regenerate(), RemoveAllControlled(), RemoveEvadeAuras(), Pet::SavePetToDB(), SetMinion(), SetOwnerGUID(), SpellPctDamageModsDone(), Map::SummonCreature(), NPCStaveQuestAI::UnitIsUnfair(), Creature::Update(), and npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI().

◆ GetPartyMembers()

void Unit::GetPartyMembers ( std::list< Unit * > &  units)
18737{
18738 Unit* owner = GetCharmerOrOwnerOrSelf();
18739 Group* group = nullptr;
18740 if (owner->IsPlayer())
18741 group = owner->ToPlayer()->GetGroup();
18742
18743 if (group)
18744 {
18745 uint8 subgroup = owner->ToPlayer()->GetSubGroup();
18746
18747 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
18748 {
18749 Player* Target = itr->GetSource();
18750
18751 // IsHostileTo check duel and controlled by enemy
18752 if (Target && Target->IsInMap(owner) && Target->GetSubGroup() == subgroup && !IsHostileTo(Target))
18753 {
18754 if (Target->IsAlive())
18755 TagUnitMap.push_back(Target);
18756
18757 for (Unit::ControlSet::iterator iterator = Target->m_Controlled.begin(); iterator != Target->m_Controlled.end(); ++iterator)
18758 {
18759 if (Unit* pet = *iterator)
18760 if (pet->IsGuardian() && pet->IsAlive())
18761 TagUnitMap.push_back(pet);
18762 }
18763 }
18764 }
18765 }
18766 else
18767 {
18768 if (owner->IsAlive())
18769 TagUnitMap.push_back(owner);
18770
18771 for (Unit::ControlSet::iterator itr = owner->m_Controlled.begin(); itr != owner->m_Controlled.end(); ++itr)
18772 {
18773 if (Unit* pet = *itr)
18774 if (pet->IsGuardian() && pet->IsAlive())
18775 TagUnitMap.push_back(pet);
18776 }
18777 }
18778}
uint8 GetSubGroup() const
Definition: Player.h:2448

References GetCharmerOrOwnerOrSelf(), Group::GetFirstMember(), Player::GetGroup(), Player::GetSubGroup(), IsAlive(), IsHostileTo(), WorldObject::IsInMap(), Object::IsPlayer(), m_Controlled, GroupReference::next(), and Object::ToPlayer().

Referenced by spell_warr_improved_spell_reflection_trigger_aura::HandleRemove().

◆ GetPetGUID()

◆ GetPhaseByAuras()

uint32 Unit::GetPhaseByAuras ( ) const
18956{
18957 uint32 currentPhase = 0;
18959 if (!phases.empty())
18960 for (AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
18961 currentPhase |= (*itr)->GetMiscValue();
18962
18963 return currentPhase;
18964}
@ SPELL_AURA_PHASE
Definition: SpellAuraDefines.h:324

References GetAuraEffectsByType(), and SPELL_AURA_PHASE.

Referenced by Player::GetPhaseMaskForSpawn(), AuraEffect::HandlePhase(), and Player::SetGameMaster().

◆ GetPosStat()

float Unit::GetPosStat ( Stats  stat) const
inline
1386{ return GetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + stat); }

References Object::GetFloatValue(), and UNIT_FIELD_POSSTAT0.

◆ GetPower()

uint32 Unit::GetPower ( Powers  power) const
inline
804{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power); }
@ UNIT_FIELD_POWER1
Definition: UpdateFields.h:97

References Object::GetUInt32Value(), and UNIT_FIELD_POWER1.

Referenced by PetAI::_canMeleeAttack(), Player::_SaveCharacter(), WorldSession::BuildPartyMemberStatsChangedPacket(), SpellInfo::CalcPowerCost(), spell_igb_cannon_blast::CalculatePower(), Creature::CanCastSpell(), Spell::CheckItems(), Spell::CheckPower(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), Spell::EffectCastButtons(), Spell::EffectWeaponDmg(), Pet::FillPetInfo(), Pet::GetHappinessState(), GetPowerPct(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), AuraEffect::HandleObsModPowerAuraTick(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetAbandon(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), spell_pal_lay_on_hands::HandleScript(), Player::InitStatsForLevel(), npc_obsidian_destroyer::JustEngagedWith(), spell_gen_replenishment_aura::Load(), Pet::LoseHappiness(), ModifyPower(), spell_mark_of_kazrogal_aura::OnPeriodic(), spell_mark_of_kazzak_aura::OnPeriodic(), Acore::PowerPctOrderPred::operator()(), SmartScript::ProcessAction(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::Regenerate(), Player::Regenerate(), Creature::RegenerateHealth(), Player::SaveManaBeforeDuel(), Pet::SavePetToDB(), Creature::SaveToDB(), ScriptedAI::SelectSpell(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetMaxPower(), SetPower(), setPowerType(), spell_igb_incinerating_blast::StoreEnergy(), Aura::Update(), boss_selin_fireheart::UpdateAI(), boss_moam::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), PetAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ GetPowerPct()

float Unit::GetPowerPct ( Powers  power) const
inline
793{ return GetMaxPower(power) ? 100.f * GetPower(power) / GetMaxPower(power) : 0.0f; }
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:805
uint32 GetPower(Powers power) const
Definition: Unit.h:804

References GetMaxPower(), and GetPower().

Referenced by npc_obsidian_destroyer::JustEngagedWith(), npc_obsidian_eradicator::JustEngagedWith(), npc_obsidian_nullifier::JustEngagedWith(), boss_curator::JustEngagedWith(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), and boss_hazzarah::UpdateAI().

◆ getPowerType()

◆ GetPowerTypeByAuraGroup()

Powers Unit::GetPowerTypeByAuraGroup ( UnitMods  unitMod) const
15334{
15335 switch (unitMod)
15336 {
15337 case UNIT_MOD_RAGE:
15338 return POWER_RAGE;
15339 case UNIT_MOD_FOCUS:
15340 return POWER_FOCUS;
15341 case UNIT_MOD_ENERGY:
15342 return POWER_ENERGY;
15343 case UNIT_MOD_HAPPINESS:
15344 return POWER_HAPPINESS;
15345 case UNIT_MOD_RUNE:
15346 return POWER_RUNE;
15348 return POWER_RUNIC_POWER;
15349 default:
15350 case UNIT_MOD_MANA:
15351 return POWER_MANA;
15352 }
15353}
@ UNIT_MOD_RUNE
Definition: Unit.h:154
@ UNIT_MOD_ENERGY
Definition: Unit.h:152
@ UNIT_MOD_FOCUS
Definition: Unit.h:151
@ UNIT_MOD_HAPPINESS
Definition: Unit.h:153
@ UNIT_MOD_MANA
Definition: Unit.h:149
@ UNIT_MOD_RAGE
Definition: Unit.h:150
@ UNIT_MOD_RUNIC_POWER
Definition: Unit.h:155

References POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNE, POWER_RUNIC_POWER, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RUNE, and UNIT_MOD_RUNIC_POWER.

Referenced by HandleStatModifier().

◆ GetPPMProcChance()

float Unit::GetPPMProcChance ( uint32  WeaponSpeed,
float  PPM,
SpellInfo const *  spellProto 
) const
13387{
13388 // proc per minute chance calculation
13389 if (PPM <= 0)
13390 return 0.0f;
13391
13392 // Apply chance modifer aura
13393 if (spellProto)
13394 if (Player* modOwner = GetSpellModOwner())
13395 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_PROC_PER_MINUTE, PPM);
13396
13397 return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
13398}
@ SPELLMOD_PROC_PER_MINUTE
Definition: SpellDefines.h:103

References GetSpellModOwner(), SpellInfo::Id, and SPELLMOD_PROC_PER_MINUTE.

Referenced by Player::CastItemCombatSpell(), and IsTriggeredAtSpellProcEvent().

◆ GetProcAurasTriggeredOnEvent()

void Unit::GetProcAurasTriggeredOnEvent ( std::list< AuraApplication * > &  aurasTriggeringProc,
std::list< AuraApplication * > *  procAuras,
ProcEventInfo  eventInfo 
)
16442{
16443 // use provided list of auras which can proc
16444 if (procAuras)
16445 {
16446 for (std::list<AuraApplication*>::iterator itr = procAuras->begin(); itr != procAuras->end(); ++itr)
16447 {
16448 ASSERT((*itr)->GetTarget() == this);
16449 if (!(*itr)->GetRemoveMode())
16450 if ((*itr)->GetBase()->IsProcTriggeredOnEvent(*itr, eventInfo))
16451 {
16452 (*itr)->GetBase()->PrepareProcToTrigger(*itr, eventInfo);
16453 aurasTriggeringProc.push_back(*itr);
16454 }
16455 }
16456 }
16457 // or generate one on our own
16458 else
16459 {
16460 for (AuraApplicationMap::iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
16461 {
16462 if (itr->second->GetBase()->IsProcTriggeredOnEvent(itr->second, eventInfo))
16463 {
16464 itr->second->GetBase()->PrepareProcToTrigger(itr->second, eventInfo);
16465 aurasTriggeringProc.push_back(itr->second);
16466 }
16467 }
16468 }
16469}

References ASSERT, and GetAppliedAuras().

Referenced by TriggerAurasProcOnEvent().

◆ getRace()

uint8 Unit::getRace ( bool  original = false) const
20910{
20911 if (IsPlayer())
20912 {
20913 if (original)
20914 return m_realRace;
20915 else
20916 return m_race;
20917 }
20918
20920}

References Object::GetByteValue(), Object::IsPlayer(), m_race, m_realRace, and UNIT_FIELD_BYTES_0.

Referenced by Player::_LoadHomeBind(), Player::_LoadSkills(), Player::_SaveCharacter(), Player::BuildPlayerRepop(), Corpse::BuildValuesUpdate(), Player::CreateCorpse(), GetModelForForm(), GetModelForTotem(), getRaceMask(), GetReactionTo(), Player::GetStartPosition(), Player::GetTeamId(), Player::GiveLevel(), WorldSession::HandleAlterAppearance(), AuraEffect::HandleAuraTransform(), WorldSession::HandleMirrorImageDataRequest(), modify_commandscript::HandleModifyGenderCommand(), misc_commandscript::HandlePInfoCommand(), WorldSession::HandlePlayerLoginFromDB(), reset_commandscript::HandleResetStatsOrLevelHelper(), Player::InitDisplayIds(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Player::InitTaxiNodesForLevel(), Creature::IsValidTrainerForPlayer(), Channel::KickOrBan(), Player::LearnCustomSpells(), Player::LearnDefaultSkill(), Player::LearnDefaultSkills(), Player::LoadFromDB(), AchievementCriteriaData::Meets(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnPlayerEnter(), RestoreFaction(), Player::RewardHonor(), WorldSession::SendNameQueryOpcode(), Player::SetGameMaster(), Player::StoreNewItemInBestSlots(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSkillsForLevel().

◆ getRaceMask()

◆ GetRandomContactPoint()

bool Unit::GetRandomContactPoint ( Unit const *  target,
float &  x,
float &  y,
float &  z,
bool  force = false 
) const
702{
703 float combat_reach = GetCombatReach();
704 if (combat_reach < 0.1f) // sometimes bugged for players
705 combat_reach = DEFAULT_COMBAT_REACH;
706
707 uint32 attacker_number = getAttackers().size();
708 if (attacker_number > 0)
709 --attacker_number;
710 Creature const* c = obj->ToCreature();
711 if (c)
712 if (c->isWorldBoss() || c->IsDungeonBoss() || (obj->IsPet() && const_cast<Unit*>(obj)->ToPet()->isControlled()))
713 attacker_number = 0; // pussywizard: pets and bosses just come to target from their angle
714
715 GetNearPoint(obj, x, y, z, isMoving() ? (obj->GetCombatReach() > 7.75f ? obj->GetCombatReach() - 7.5f : 0.25f) : obj->GetCombatReach(), 0.0f,
716 GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI / 2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0));
717
718 // pussywizard
719 if (std::fabs(this->GetPositionZ() - z) > this->GetCollisionHeight() || !IsWithinLOS(x, y, z))
720 {
721 x = this->GetPositionX();
722 y = this->GetPositionY();
723 z = this->GetPositionZ();
724 obj->UpdateAllowedPositionZ(x, y, z);
725 }
726 float maxDist = GetMeleeRange(obj);
727 if (GetExactDistSq(x, y, z) >= maxDist * maxDist)
728 {
729 if (force)
730 {
731 x = this->GetPositionX();
732 y = this->GetPositionY();
733 z = this->GetPositionZ();
734 return true;
735 }
736 return false;
737 }
738 return true;
739}
#define DEFAULT_COMBAT_REACH
Definition: ObjectDefines.h:46
bool IsDungeonBoss() const
Definition: Creature.cpp:3148
bool IsWithinLOS(float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
Definition: Object.cpp:1326
float GetExactDistSq(float x, float y, float z) const
Definition: Position.h:170
bool isControlled() const
Definition: Pet.h:54
float GetCollisionHeight() const override
Return collision height sent to client.
Definition: Unit.cpp:21009
float GetMeleeRange(Unit const *target) const
Definition: Unit.cpp:680

References DEFAULT_COMBAT_REACH, Position::GetAngle(), getAttackers(), GetCollisionHeight(), GetCombatReach(), Position::GetExactDistSq(), GetMeleeRange(), WorldObject::GetNearPoint(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Pet::isControlled(), Creature::IsDungeonBoss(), isMoving(), IsPet(), WorldObject::IsWithinLOS(), Creature::isWorldBoss(), rand_norm(), Object::ToCreature(), ToPet(), and WorldObject::UpdateAllowedPositionZ().

Referenced by boss_bug_trio::DamageTaken(), and boss_bug_trio::DoFinalSpell().

◆ GetRangedCritChanceReduction()

float Unit::GetRangedCritChanceReduction ( ) const
inline

◆ GetRangedCritDamageReduction()

uint32 Unit::GetRangedCritDamageReduction ( uint32  damage) const
inline

◆ GetRangedDamageReduction()

uint32 Unit::GetRangedDamageReduction ( uint32  damage) const
inline

◆ GetReactionTo()

ReputationRank Unit::GetReactionTo ( Unit const *  target,
bool  checkOriginalFaction = false 
) const
10007{
10008 // always friendly to self
10009 if (this == target)
10010 return REP_FRIENDLY;
10011
10012 // always friendly to charmer or owner
10014 return REP_FRIENDLY;
10015
10016 Player const* selfPlayerOwner = GetAffectingPlayer();
10017 Player const* targetPlayerOwner = target->GetAffectingPlayer();
10018
10019 // check forced reputation to support SPELL_AURA_FORCE_REACTION
10020 if (selfPlayerOwner)
10021 {
10022 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
10023 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
10024 return *repRank;
10025 }
10026 else if (targetPlayerOwner)
10027 {
10028 if (FactionTemplateEntry const* selfFactionTemplateEntry = GetFactionTemplateEntry())
10029 if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(selfFactionTemplateEntry))
10030 return *repRank;
10031 }
10032
10034 {
10035 if (target->HasUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED))
10036 {
10037 if (selfPlayerOwner && targetPlayerOwner)
10038 {
10039 // always friendly to other unit controlled by player, or to the player himself
10040 if (selfPlayerOwner == targetPlayerOwner)
10041 return REP_FRIENDLY;
10042
10043 // duel - always hostile to opponent
10044 if (selfPlayerOwner->duel && selfPlayerOwner->duel->Opponent == targetPlayerOwner && selfPlayerOwner->duel->State == DUEL_STATE_IN_PROGRESS)
10045 return REP_HOSTILE;
10046
10047 // same group - checks dependant only on our faction - skip FFA_PVP for example
10048 if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner))
10049 return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work
10050 // however client seems to allow mixed group parties, because in 13850 client it works like:
10051 // return GetFactionReactionTo(GetFactionTemplateEntry(), target);
10052 }
10053
10054 // check FFA_PVP
10055 if (IsFFAPvP() && target->IsFFAPvP())
10056 return REP_HOSTILE;
10057
10058 if (selfPlayerOwner)
10059 {
10060 if (FactionTemplateEntry const* targetFactionTemplateEntry = target->GetFactionTemplateEntry())
10061 {
10062 if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry))
10063 return *repRank;
10064 if (!selfPlayerOwner->HasUnitFlag2(UNIT_FLAG2_IGNORE_REPUTATION))
10065 {
10066 if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction))
10067 {
10068 if (targetFactionEntry->CanHaveReputation())
10069 {
10070 // check contested flags
10071 if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS
10072 && selfPlayerOwner->HasPlayerFlag(PLAYER_FLAGS_CONTESTED_PVP))
10073 return REP_HOSTILE;
10074
10075 // if faction has reputation, hostile state depends only from AtWar state
10076 if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry))
10077 return REP_HOSTILE;
10078 return REP_FRIENDLY;
10079 }
10080 }
10081 }
10082 }
10083 }
10084 }
10085 }
10086
10087 ReputationRank repRank = REP_HATED;
10088 if (!sScriptMgr->IfNormalReaction(this, target, repRank))
10089 {
10090 return ReputationRank(repRank);
10091 }
10092
10093 FactionTemplateEntry const* factionTemplateEntry = nullptr;
10094 if (checkOriginalFaction)
10095 {
10096 if (IsPlayer())
10097 {
10098 if (ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(getRace()))
10099 {
10100 factionTemplateEntry = sFactionTemplateStore.LookupEntry(rEntry->FactionID);
10101 }
10102 }
10103 else
10104 {
10105 Unit* owner = GetOwner();
10106 if (HasUnitTypeMask(UNIT_MASK_MINION) && owner)
10107 {
10108 factionTemplateEntry = sFactionTemplateStore.LookupEntry(owner->GetFaction());
10109 }
10110 else if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate())
10111 {
10112 factionTemplateEntry = sFactionTemplateStore.LookupEntry(cinfo->faction);
10113 }
10114 }
10115 }
10116
10117 if (!factionTemplateEntry)
10118 {
10119 factionTemplateEntry = GetFactionTemplateEntry();
10120 }
10121
10122 // do checks dependant only on our faction
10123 return GetFactionReactionTo(factionTemplateEntry, target);
10124}
DBCStorage< ChrRacesEntry > sChrRacesStore(ChrRacesEntryfmt)
@ REP_HATED
Definition: SharedDefines.h:180
bool HasPlayerFlag(PlayerFlags flags) const
Definition: Player.h:1107
ReputationRank GetFactionReactionTo(FactionTemplateEntry const *factionTemplateEntry, Unit const *target) const
Definition: Unit.cpp:10126
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:18714
bool IsAtWar(uint32 faction_id) const
Definition: ReputationMgr.cpp:55
Definition: DBCStructure.h:679

References Player::duel, DUEL_STATE_IN_PROGRESS, FACTION_TEMPLATE_FLAG_ATTACK_PVP_ACTIVE_PLAYERS, GetAffectingPlayer(), GetCharmerOrOwnerOrSelf(), GetFaction(), GetFactionReactionTo(), GetFactionTemplateEntry(), ReputationMgr::GetForcedRankIfAny(), GetOwner(), getRace(), Player::GetReputationMgr(), Player::HasPlayerFlag(), HasUnitFlag(), HasUnitFlag2(), HasUnitTypeMask(), ReputationMgr::IsAtWar(), IsFFAPvP(), IsInRaidWith(), Object::IsPlayer(), PLAYER_FLAGS_CONTESTED_PVP, REP_FRIENDLY, REP_HATED, REP_HOSTILE, sChrRacesStore, sFactionStore, sFactionTemplateStore, sScriptMgr, Object::ToCreature(), UNIT_FLAG2_IGNORE_REPUTATION, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_MINION.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), GetDispellableAuraList(), Player::GetNPCIfCanInteractWith(), IsFriendlyTo(), IsHostileTo(), and Condition::Meets().

◆ GetRedirectThreatPercent()

uint32 Unit::GetRedirectThreatPercent ( )
inline
uint32 GetThreatPct() const
Definition: ThreatMgr.h:300

References _redirectThreatInfo, and RedirectThreatInfo::GetThreatPct().

Referenced by ThreatMgr::DoAddThreat().

◆ GetRedirectThreatTarget()

Unit * Unit::GetRedirectThreatTarget ( ) const

◆ GetResistance() [1/2]

uint32 Unit::GetResistance ( SpellSchoolMask  mask) const
20237{
20238 int32 resist = -1;
20239 for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
20240 if (mask & (1 << i) && (resist < 0 || resist > int32(GetResistance(SpellSchools(i)))))
20241 resist = int32(GetResistance(SpellSchools(i)));
20242
20243 // resist value will never be negative here
20244 return uint32(resist);
20245}

References GetResistance(), MAX_SPELL_SCHOOL, and SPELL_SCHOOL_NORMAL.

◆ GetResistance() [2/2]

uint32 Unit::GetResistance ( SpellSchools  school) const
inline
777{ return GetUInt32Value(static_cast<uint16>(UNIT_FIELD_RESISTANCES) + school); }
@ UNIT_FIELD_RESISTANCES
Definition: UpdateFields.h:156

References Object::GetUInt32Value(), and UNIT_FIELD_RESISTANCES.

Referenced by Player::_SaveStats(), GetArmor(), GetEffectiveResistChance(), GetResistance(), and Player::outDebugValues().

◆ GetResistanceBuffMods()

float Unit::GetResistanceBuffMods ( SpellSchools  school,
bool  positive 
) const
inline

◆ GetShapeshiftForm()

◆ GetSharedVisionList()

◆ GetSheath()

SheathState Unit::GetSheath ( ) const
inline
SheathState
Definition: UnitDefines.h:104

References Object::GetByteValue(), and UNIT_FIELD_BYTES_2.

◆ GetShieldBlockValue() [1/2]

virtual uint32 Unit::GetShieldBlockValue ( ) const
pure virtual

◆ GetShieldBlockValue() [2/2]

uint32 Unit::GetShieldBlockValue ( uint32  soft_cap,
uint32  hard_cap 
) const
inline
968 {
969 uint32 value = GetShieldBlockValue();
970 if (value >= hard_cap)
971 {
972 value = (soft_cap + hard_cap) / 2;
973 }
974 else if (value > soft_cap)
975 {
976 value = soft_cap + ((value - soft_cap) / 2);
977 }
978
979 return value;
980 }

References GetShieldBlockValue().

◆ GetSingleCastAuras() [1/2]

AuraList & Unit::GetSingleCastAuras ( )
inline

◆ GetSingleCastAuras() [2/2]

AuraList const & Unit::GetSingleCastAuras ( ) const
inline
1312{ return m_scAuras; }

References m_scAuras.

◆ GetSpeed()

◆ GetSpeedRate()

◆ GetSpellCritChanceReduction()

float Unit::GetSpellCritChanceReduction ( ) const
inline

◆ GetSpellCritDamageReduction()

◆ GetSpellDamageReduction()

uint32 Unit::GetSpellDamageReduction ( uint32  damage) const
inline

◆ GetSpellMaxRangeForTarget()

float Unit::GetSpellMaxRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
15075{
15076 if (!spellInfo->RangeEntry)
15077 {
15078 return 0;
15079 }
15080
15081 if (spellInfo->RangeEntry->RangeMax[1] == spellInfo->RangeEntry->RangeMax[0])
15082 {
15083 return spellInfo->GetMaxRange();
15084 }
15085
15086 if (!target)
15087 {
15088 return spellInfo->GetMaxRange(true);
15089 }
15090
15091 return spellInfo->GetMaxRange(!IsHostileTo(target));
15092}

References SpellInfo::GetMaxRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMax.

Referenced by spell_sha_fire_nova::CheckFireTotem(), Spell::CheckRange(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), ScriptedAI::SelectSpell(), GameObject::TriggeringLinkedGameObject(), and Pet::Update().

◆ GetSpellMinRangeForTarget()

float Unit::GetSpellMinRangeForTarget ( Unit const *  target,
SpellInfo const *  spellInfo 
) const
15095{
15096 if (!spellInfo->RangeEntry)
15097 {
15098 return 0;
15099 }
15100
15101 if (spellInfo->RangeEntry->RangeMin[1] == spellInfo->RangeEntry->RangeMin[0])
15102 {
15103 return spellInfo->GetMinRange();
15104 }
15105
15106 return spellInfo->GetMinRange(!IsHostileTo(target));
15107}

References SpellInfo::GetMinRange(), IsHostileTo(), SpellInfo::RangeEntry, and SpellRangeEntry::RangeMin.

Referenced by Spell::CheckRange(), SpellTargetSelector::operator()(), SmartScript::ProcessAction(), and ScriptedAI::SelectSpell().

◆ GetSpellModOwner()

Player * Unit::GetSpellModOwner ( ) const
16506{
16507 if (Player* player = const_cast<Unit*>(this)->ToPlayer())
16508 {
16509 return player;
16510 }
16511
16512 if (Unit* owner = GetOwner())
16513 {
16514 if (Player* player = owner->ToPlayer())
16515 {
16516 return player;
16517 }
16518 }
16519
16520 // Special handling for Eye of Kilrogg
16522 {
16523 if (TempSummon const* tempSummon = ToTempSummon())
16524 {
16525 if (Unit* summoner = tempSummon->GetSummonerUnit())
16526 {
16527 return summoner->ToPlayer();
16528 }
16529 }
16530 }
16531
16532 return nullptr;
16533}
@ NPC_EYE_OF_KILROGG
Definition: PetDefines.h:101
Definition: TemporarySummon.h:40

References Object::GetEntry(), GetOwner(), NPC_EYE_OF_KILROGG, Object::ToPlayer(), and ToTempSummon().

Referenced by Spell::_cast(), Creature::AddSpellCooldown(), ApplyEffectModifiers(), CalcArmorReducedDamage(), SpellEffectInfo::CalcDamageMultiplier(), Aura::CalcDispelChance(), Aura::CalcMaxCharges(), Aura::CalcMaxDuration(), AuraEffect::CalcPeriodicCritChance(), SpellInfo::CalcPowerCost(), Aura::CalcProcChance(), SpellEffectInfo::CalcRadius(), ThreatCalcHelper::calcThreat(), spell_dru_brambles_treant::CalculateAmount(), AuraEffect::CalculatePeriodic(), CalculateSpellDamageTaken(), SpellEffectInfo::CalcValueMultiplier(), Spell::cancel(), Spell::cast(), Spell::CheckRange(), Spell::CheckRuneCost(), Spell::EffectSummonPet(), Spell::EffectSummonType(), Spell::finish(), GetEffectiveResistChance(), SpellInfo::GetMaxRange(), GetPPMProcChance(), Spell::handle_delayed(), Spell::handle_immediate(), IsAlwaysDetectableFor(), SpellInfo::IsStrongerAuraActive(), IsTriggeredAtSpellProcEvent(), MagicSpellHitResult(), MeleeDamageBonusDone(), MeleeSpellMissChance(), ModSpellCastTime(), Spell::SelectImplicitChainTargets(), Aura::SetDuration(), SpellCriticalDamageBonus(), SpellCriticalHealingBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), SpellHealingBonusDone(), Spell::SummonGuardian(), Spell::TakePower(), Spell::TakeRunePower(), Spell::UpdateChanneledTargetList(), and Aura::UpdateOwner().

◆ GetSpellSchoolByAuraGroup()

SpellSchools Unit::GetSpellSchoolByAuraGroup ( UnitMods  unitMod) const
15273{
15275
15276 switch (unitMod)
15277 {
15279 school = SPELL_SCHOOL_HOLY;
15280 break;
15282 school = SPELL_SCHOOL_FIRE;
15283 break;
15285 school = SPELL_SCHOOL_NATURE;
15286 break;
15288 school = SPELL_SCHOOL_FROST;
15289 break;
15291 school = SPELL_SCHOOL_SHADOW;
15292 break;
15294 school = SPELL_SCHOOL_ARCANE;
15295 break;
15296
15297 default:
15298 break;
15299 }
15300
15301 return school;
15302}
@ UNIT_MOD_RESISTANCE_SHADOW
Definition: Unit.h:161
@ UNIT_MOD_RESISTANCE_FROST
Definition: Unit.h:160
@ UNIT_MOD_RESISTANCE_HOLY
Definition: Unit.h:157
@ UNIT_MOD_RESISTANCE_ARCANE
Definition: Unit.h:162
@ UNIT_MOD_RESISTANCE_FIRE
Definition: Unit.h:158
@ UNIT_MOD_RESISTANCE_NATURE
Definition: Unit.h:159
@ SPELL_SCHOOL_SHADOW
Definition: SharedDefines.h:288
@ SPELL_SCHOOL_NATURE
Definition: SharedDefines.h:286
@ SPELL_SCHOOL_FROST
Definition: SharedDefines.h:287
@ SPELL_SCHOOL_ARCANE
Definition: SharedDefines.h:289
@ SPELL_SCHOOL_FIRE
Definition: SharedDefines.h:285
@ SPELL_SCHOOL_HOLY
Definition: SharedDefines.h:284

References SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, and UNIT_MOD_RESISTANCE_SHADOW.

Referenced by HandleStatModifier().

◆ getStandState()

◆ GetStat()

◆ GetStatByAuraGroup()

Stats Unit::GetStatByAuraGroup ( UnitMods  unitMod) const
15305{
15306 Stats stat = STAT_STRENGTH;
15307
15308 switch (unitMod)
15309 {
15311 stat = STAT_STRENGTH;
15312 break;
15314 stat = STAT_AGILITY;
15315 break;
15317 stat = STAT_STAMINA;
15318 break;
15320 stat = STAT_INTELLECT;
15321 break;
15323 stat = STAT_SPIRIT;
15324 break;
15325
15326 default:
15327 break;
15328 }
15329
15330 return stat;
15331}
@ UNIT_MOD_STAT_INTELLECT
Definition: Unit.h:146
@ UNIT_MOD_STAT_SPIRIT
Definition: Unit.h:147
@ UNIT_MOD_STAT_STRENGTH
Definition: Unit.h:143
@ UNIT_MOD_STAT_AGILITY
Definition: Unit.h:144
@ UNIT_MOD_STAT_STAMINA
Definition: Unit.h:145
Stats
Definition: SharedDefines.h:257
@ STAT_SPIRIT
Definition: SharedDefines.h:262
@ STAT_INTELLECT
Definition: SharedDefines.h:261
@ STAT_AGILITY
Definition: SharedDefines.h:259
@ STAT_STRENGTH
Definition: SharedDefines.h:258
@ STAT_STAMINA
Definition: SharedDefines.h:260

References STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STAMINA, STAT_STRENGTH, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, and UNIT_MOD_STAT_STRENGTH.

Referenced by HandleStatModifier().

◆ GetTarget()

◆ GetThreatMgr() [1/2]

ThreatMgr & Unit::GetThreatMgr ( )
inline
1488{ return m_ThreatMgr; }

References m_ThreatMgr.

Referenced by CreatureAI::_EnterEvadeMode(), npc_vengeful_shade::npc_vengeful_shadeAI::AttackStart(), boss_razorgore::boss_razorgoreAI::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_jindo::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_nethermancer_sepethrea::CanAIAttack(), boss_mor_grayhoof::CastRandomSpell(), CleanupBeforeRemoveFromMap(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), npc_magister_aledis::DamageTaken(), boss_ysondre::boss_ysondreAI::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), ScriptedAI::DoAddThreat(), UnitAI::DoCastToAllHostilePlayers(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ScriptedAI::DoGetThreat(), ScriptedAI::DoModifyThreatByPercent(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), ScriptedAI::DoResetThreat(), ScriptedAI::DoResetThreatList(), Spell::EffectModifyThreatPercent(), Spell::EffectTaunt(), boss_faction_championsAI::EnemiesInRange(), boss_ragnaros::boss_ragnarosAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), boss_murmur::EnterEvadeMode(), boss_alar::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::EnterEvadeMode(), npc_varian_wrynn::npc_varian_wrynnAI::EnterEvadeMode(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), boss_ouro::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), violet_hold_trashAI::EnterEvadeMode(), npc_pet_hunter_snake_trap::EnterEvadeMode(), npc_escortAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), TemporaryThreatModifierEvent::Execute(), StartMovementEvent::Execute(), boss_supremus::FindHatefulStrikeTarget(), npc_raging_flames::FixateRandomTarget(), SmartScript::GetTargets(), UnitAI::GetThreatMgr(), debug_commandscript::HandleDebugThreatListCommand(), spell_karazhan_blink::HandleDummy(), spell_kaelthas_mind_control::HandleEffect(), spell_tharon_ja_dummy_aura::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_enveloping_webs::HandleOnHit(), spell_arcane_vacuum::HandleOnHit(), HandleProcTriggerSpell(), PetAI::HandleReturnMovement(), spell_pursue::HandleScript(), spell_gurtogg_eject::HandleScriptEffect(), spell_leotheras_whirlwind::HandleScriptEffect(), boss_attumen::IsSummonedBy(), boss_blackheart_the_inciter::JustEngagedWith(), boss_jindo::JustSummoned(), Kill(), boss_urom::boss_uromAI::LeaveCombat(), Creature::ModifyThreatPercentTemp(), boss_bug_trio::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), NonTankTargetSelector::operator()(), StoneGripTargetSelector::operator()(), boss_jeklik::PathEndReached(), SmartScript::ProcessAction(), SmartScript::ProcessEvent(), boss_priestess_lackey_commonAI::RecalculateThreat(), boss_faction_championsAI::RecalculateThreat(), boss_talon_king_ikiss::Reset(), boss_faction_championsAI::SelectEnemyCaster(), npc_scholomance_occultist::npc_scholomance_occultistAI::SelectUnitCasting(), SendChangeCurrentVictimOpcode(), SendThreatListUpdate(), setDeathState(), SetPhaseMask(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), boss_ouro::SpellHitTarget(), spell_putricide_ooze_channel::StartAttack(), BossAI::TeleportCheaters(), Creature::Update(), Update(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_nefarian::UpdateAI(), boss_yazzai::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_sartura::UpdateAI(), npc_sartura_royal_guard::UpdateAI(), boss_taldaram::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_frozen_orb::npc_frozen_orbAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_the_lurker_below::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), boss_netherspite::UpdatePortals(), and CreatureAI::UpdateVictim().

◆ GetThreatMgr() [2/2]

ThreatMgr const & Unit::GetThreatMgr ( ) const
inline
1489{ return m_ThreatMgr; }

References m_ThreatMgr.

◆ GetTotalAttackPowerValue()

float Unit::GetTotalAttackPowerValue ( WeaponAttackType  attType,
Unit pVictim = nullptr 
) const
15356{
15357 if (attType == RANGED_ATTACK)
15358 {
15360 if( victim )
15361 ap += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
15362
15363 if (ap < 0)
15364 return 0.0f;
15366 }
15367 else
15368 {
15370 if( victim )
15371 ap += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
15372
15373 if (ap < 0)
15374 return 0.0f;
15376 }
15377}
@ SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS
Definition: SpellAuraDefines.h:190
@ SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS
Definition: SpellAuraDefines.h:228
@ UNIT_FIELD_ATTACK_POWER_MODS
Definition: UpdateFields.h:163
@ UNIT_FIELD_RANGED_ATTACK_POWER
Definition: UpdateFields.h:165
@ UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:167
@ UNIT_FIELD_ATTACK_POWER_MULTIPLIER
Definition: UpdateFields.h:164
@ UNIT_FIELD_ATTACK_POWER
Definition: UpdateFields.h:162
@ UNIT_FIELD_RANGED_ATTACK_POWER_MODS
Definition: UpdateFields.h:166
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:299

References Object::GetFloatValue(), Object::GetInt32Value(), GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, UNIT_FIELD_ATTACK_POWER, UNIT_FIELD_ATTACK_POWER_MODS, UNIT_FIELD_ATTACK_POWER_MULTIPLIER, UNIT_FIELD_RANGED_ATTACK_POWER, UNIT_FIELD_RANGED_ATTACK_POWER_MODS, and UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER.

Referenced by spell_dk_ghoul_thrash::CalcDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_execute::HandleEffect(), spell_pal_seal_of_righteousness::HandleProc(), HandleProcTriggerSpell(), Spell::HandleThreatSpells(), Guardian::InitStatsForLevel(), SpellBaseDamageBonusDone(), SpellBaseHealingBonusDone(), SpellDamageBonusDone(), SpellHealingBonusDone(), Guardian::UpdateDamagePhysical(), and lfg::LFGMgr::UpdateRaidBrowser().

◆ GetTotalAuraModifier()

◆ GetTotalAuraModifierAreaExclusive()

int32 Unit::GetTotalAuraModifierAreaExclusive ( AuraType  auratype) const
5842{
5843 int32 modifier = 0;
5844 int32 areaModifier = 0;
5845
5846 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5847 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5848 {
5849 if ((*i)->GetSpellInfo()->HasAreaAuraEffect())
5850 {
5851 if (areaModifier < (*i)->GetAmount())
5852 areaModifier = (*i)->GetAmount();
5853 }
5854 else
5855 modifier += (*i)->GetAmount();
5856 }
5857
5858 return modifier + areaModifier;
5859}

References GetAuraEffectsByType().

Referenced by Player::UpdateSpellCritChance().

◆ GetTotalAuraModifierByAffectMask()

int32 Unit::GetTotalAuraModifierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6018{
6019 int32 modifier = 0;
6020
6021 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6022 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6023 if ((*i)->IsAffectedOnSpell(affectedSpell))
6024 modifier += (*i)->GetAmount();
6025
6026 return modifier;
6027}

References GetAuraEffectsByType().

◆ GetTotalAuraModifierByMiscMask()

int32 Unit::GetTotalAuraModifierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5913{
5914 int32 modifier = 0;
5915
5916 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5917 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5918 {
5919 if ((*i)->GetMiscValue()& misc_mask)
5920 modifier += (*i)->GetAmount();
5921 }
5922 return modifier;
5923}

References GetAuraEffectsByType().

Referenced by CalcArmorReducedDamage(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), GetEffectiveResistChance(), MagicSpellHitResult(), SpellCriticalDamageBonus(), SpellDamageBonusDone(), SpellDoneCritChance(), and Player::UpdateSpellCritChance().

◆ GetTotalAuraModifierByMiscValue()

int32 Unit::GetTotalAuraModifierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5966{
5967 int32 modifier = 0;
5968
5969 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5970 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5971 if ((*i)->GetMiscValue() == misc_value)
5972 modifier += (*i)->GetAmount();
5973
5974 return modifier;
5975}

References GetAuraEffectsByType().

Referenced by Player::CalculateReputationGain(), GetMechanicResistChance(), MeleeSpellHitResult(), ModSpellDuration(), Creature::Regenerate(), Player::Regenerate(), RollMeleeOutcomeAgainst(), and Player::UpdateManaRegen().

◆ GetTotalAuraModValue()

float Unit::GetTotalAuraModValue ( UnitMods  unitMod) const
15246{
15247 if (unitMod >= UNIT_MOD_END)
15248 {
15249 LOG_ERROR("entities.unit", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!");
15250 return 0.0f;
15251 }
15252
15253 if (m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
15254 return 0.0f;
15255
15256 float value = m_auraModifiersGroup[unitMod][BASE_VALUE];
15257 value *= m_auraModifiersGroup[unitMod][BASE_PCT];
15258 value += m_auraModifiersGroup[unitMod][TOTAL_VALUE];
15259 value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
15260
15261 return value;
15262}

References BASE_PCT, BASE_VALUE, LOG_ERROR, m_auraModifiersGroup, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_END.

Referenced by Creature::UpdateArmor(), Creature::UpdateMaxHealth(), Creature::UpdateMaxPower(), and Creature::UpdateResistances().

◆ GetTotalAuraMultiplier()

float Unit::GetTotalAuraMultiplier ( AuraType  auratype) const
5876{
5877 float multiplier = 1.0f;
5878
5879 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5880 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5881 AddPct(multiplier, (*i)->GetAmount());
5882
5883 return multiplier;
5884}

References AddPct(), and GetAuraEffectsByType().

Referenced by MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), SpellCriticalHealingBonus(), and UpdateSpeed().

◆ GetTotalAuraMultiplierByAffectMask()

float Unit::GetTotalAuraMultiplierByAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
6030{
6031 float multiplier = 1.0f;
6032
6033 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
6034 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
6035 if ((*i)->IsAffectedOnSpell(affectedSpell))
6036 AddPct(multiplier, (*i)->GetAmount());
6037
6038 return multiplier;
6039}

References AddPct(), and GetAuraEffectsByType().

◆ GetTotalAuraMultiplierByMiscMask()

float Unit::GetTotalAuraMultiplierByMiscMask ( AuraType  auratype,
uint32  misc_mask 
) const
5926{
5927 float multiplier = 1.0f;
5928
5929 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5930 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5931 if (((*i)->GetMiscValue() & misc_mask))
5932 AddPct(multiplier, (*i)->GetAmount());
5933
5934 return multiplier;
5935}

References AddPct(), and GetAuraEffectsByType().

Referenced by CalculateAOEDamageReduction(), CalculateMeleeDamage(), MeleeDamageBonusTaken(), and SpellCriticalHealingBonus().

◆ GetTotalAuraMultiplierByMiscValue()

float Unit::GetTotalAuraMultiplierByMiscValue ( AuraType  auratype,
int32  misc_value 
) const
5978{
5979 float multiplier = 1.0f;
5980
5981 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5982 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5983 if ((*i)->GetMiscValue() == misc_value)
5984 AddPct(multiplier, (*i)->GetAmount());
5985
5986 return multiplier;
5987}

References AddPct(), and GetAuraEffectsByType().

Referenced by Player::UpdateManaRegen().

◆ GetTotalStatValue()

float Unit::GetTotalStatValue ( Stats  stat,
float  additionalValue = 0.0f 
) const
15230{
15231 UnitMods unitMod = UnitMods(static_cast<uint16>(UNIT_MOD_STAT_START) + stat);
15232
15233 if (m_auraModifiersGroup[unitMod][TOTAL_PCT] <= 0.0f)
15234 return 0.0f;
15235
15236 // value = ((base_value * base_pct) + total_value) * total_pct
15237 float value = m_auraModifiersGroup[unitMod][BASE_VALUE] + GetCreateStat(stat);
15238 value *= m_auraModifiersGroup[unitMod][BASE_PCT];
15239 value += m_auraModifiersGroup[unitMod][TOTAL_VALUE] + additionalValue;
15240 value *= m_auraModifiersGroup[unitMod][TOTAL_PCT];
15241
15242 return value;
15243}
UnitMods
Definition: Unit.h:142
@ UNIT_MOD_STAT_START
Definition: Unit.h:170
float GetCreateStat(Stats stat) const
Definition: Unit.h:1388

References BASE_PCT, BASE_VALUE, GetCreateStat(), m_auraModifiersGroup, TOTAL_PCT, TOTAL_VALUE, and UNIT_MOD_STAT_START.

Referenced by Player::UpdateAllStats(), Guardian::UpdateStats(), and Player::UpdateStats().

◆ getTransForm()

◆ GetTransGUID()

◆ GetUnitBlockChance()

float Unit::GetUnitBlockChance ( ) const
3670{
3671 if (Player const* player = ToPlayer())
3672 {
3673 if (player->CanBlock())
3674 {
3675 Item* tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
3676 if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block)
3678 }
3679 // is player but has no block ability or no not broken shield equipped
3680 return 0.0f;
3681 }
3682 else
3683 {
3684 if (ToCreature()->IsTotem())
3685 return 0.0f;
3686 else
3687 {
3688 float block = 5.0f;
3690 return block > 0.0f ? block : 0.0f;
3691 }
3692 }
3693}
@ SPELL_AURA_MOD_BLOCK_PERCENT
Definition: SpellAuraDefines.h:114
@ PLAYER_BLOCK_PERCENTAGE
Definition: UpdateFields.h:346
@ EQUIPMENT_SLOT_OFFHAND
Definition: Player.h:691
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:670
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:545
bool IsBroken() const
Definition: Item.h:257
uint32 Block
Definition: ItemTemplate.h:674

References ItemTemplate::Block, EQUIPMENT_SLOT_OFFHAND, Object::GetFloatValue(), Item::GetTemplate(), GetTotalAuraModifier(), INVENTORY_SLOT_BAG_0, Item::IsBroken(), IsTotem(), PLAYER_BLOCK_PERCENTAGE, SPELL_AURA_MOD_BLOCK_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitCriticalChance()

float Unit::GetUnitCriticalChance ( WeaponAttackType  attackType,
Unit const *  victim 
) const
3696{
3697 float crit;
3698
3699 if (IsPlayer())
3700 {
3701 switch (attackType)
3702 {
3703 case BASE_ATTACK:
3705 break;
3706 case OFF_ATTACK:
3708 break;
3709 case RANGED_ATTACK:
3711 break;
3712 // Just for good manner
3713 default:
3714 crit = 0.0f;
3715 break;
3716 }
3717 }
3718 else
3719 {
3720 crit = 5.0f;
3723 }
3724
3725 // flat aura mods
3726 if (attackType == RANGED_ATTACK)
3727 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE);
3728 else
3729 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE);
3730
3731 AuraEffectList const& mTotalAuraList = victim->GetAuraEffectsByType(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER);
3732 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
3733 {
3734 if (GetGUID() != (*i)->GetCasterGUID())
3735 continue;
3736
3737 crit += (*i)->GetAmount();
3738 }
3739
3740 // reduce crit chance from Rating for players
3741 if (attackType != RANGED_ATTACK)
3742 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_MELEE);
3743 else
3744 Unit::ApplyResilience(victim, &crit, nullptr, false, CR_CRIT_TAKEN_RANGED);
3745
3746 // Apply crit chance from defence skill
3747 crit += (int32(GetMaxSkillValueForLevel(victim)) - int32(victim->GetDefenseSkillValue(this))) * 0.04f;
3748
3749 // xinef: SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE should be calculated at the end
3750 crit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE);
3751
3752 if (crit < 0.0f)
3753 crit = 0.0f;
3754 return crit;
3755}
@ SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER
Definition: SpellAuraDefines.h:371
@ SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE
Definition: SpellAuraDefines.h:251
@ SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
Definition: SpellAuraDefines.h:260
@ SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE
Definition: SpellAuraDefines.h:250
@ SPELL_AURA_MOD_CRIT_PCT
Definition: SpellAuraDefines.h:353
@ SPELL_AURA_MOD_WEAPON_CRIT_PERCENT
Definition: SpellAuraDefines.h:115
@ PLAYER_RANGED_CRIT_PERCENTAGE
Definition: UpdateFields.h:352
@ PLAYER_CRIT_PERCENTAGE
Definition: UpdateFields.h:351
@ PLAYER_OFFHAND_CRIT_PERCENTAGE
Definition: UpdateFields.h:353
uint16 GetMaxSkillValueForLevel(Unit const *target=nullptr) const
Definition: Unit.h:892

References ApplyResilience(), BASE_ATTACK, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, GetAuraEffectsByType(), GetDefenseSkillValue(), Object::GetFloatValue(), Object::GetGUID(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), Object::IsPlayer(), OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_MOD_CRIT_PCT, and SPELL_AURA_MOD_WEAPON_CRIT_PERCENT.

Referenced by spell_dk_wandering_plague_aura::CheckProc(), and RollMeleeOutcomeAgainst().

◆ GetUnitDodgeChance()

float Unit::GetUnitDodgeChance ( ) const
3608{
3609 if (IsPlayer())
3610 return ToPlayer()->GetRealDodge(); //GetFloatValue(PLAYER_DODGE_PERCENTAGE);
3611 else
3612 {
3613 if (ToCreature()->IsTotem())
3614 return 0.0f;
3615 else
3616 {
3617 float dodge = ToCreature()->isWorldBoss() ? 5.85f : 5.0f; // Xinef: bosses should have 6.5% dodge (5.9 + 0.6 from defense skill difference)
3619 return dodge > 0.0f ? dodge : 0.0f;
3620 }
3621 }
3622}
@ SPELL_AURA_MOD_DODGE_PERCENT
Definition: SpellAuraDefines.h:112
float GetRealDodge() const
Definition: Player.h:2584

References Player::GetRealDodge(), GetTotalAuraModifier(), Object::IsPlayer(), IsTotem(), Creature::isWorldBoss(), SPELL_AURA_MOD_DODGE_PERCENT, Object::ToCreature(), and Object::ToPlayer().

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitFlags()

◆ GetUnitFlags2()

UnitFlags2 Unit::GetUnitFlags2 ( ) const
inline

Remove all UnitFlags and set new ones. UnitFlags available in UnitDefines.h.

@ UNIT_FIELD_FLAGS_2
Definition: UpdateFields.h:118
UnitFlags2
Definition: UnitDefines.h:266

References Object::GetUInt32Value(), and UNIT_FIELD_FLAGS_2.

Referenced by npc_commandscript::HandleNpcInfoCommand().

◆ GetUnitMeleeSkill()

uint32 Unit::GetUnitMeleeSkill ( Unit const *  target = nullptr) const
inline
981{ return (target ? getLevelForTarget(target) : GetLevel()) * 5; }

References GetLevel(), and getLevelForTarget().

Referenced by DealMeleeDamage(), GetDefenseSkillValue(), and GetWeaponSkillValue().

◆ GetUnitMissChance()

float Unit::GetUnitMissChance ( WeaponAttackType  attType) const
3655{
3656 float miss_chance = 5.00f;
3657
3658 if (Player const* player = ToPlayer())
3659 miss_chance += player->GetMissPercentageFromDefence();
3660
3661 if (attType == RANGED_ATTACK)
3663 else
3665
3666 return miss_chance;
3667}
@ SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE
Definition: SpellAuraDefines.h:247
@ SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE
Definition: SpellAuraDefines.h:248

References GetTotalAuraModifier(), RANGED_ATTACK, SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE, and Object::ToPlayer().

Referenced by MeleeSpellMissChance().

◆ GetUnitMovementFlags()

◆ GetUnitParryChance()

float Unit::GetUnitParryChance ( ) const
3625{
3626 float chance = 0.0f;
3627
3628 if (Player const* player = ToPlayer())
3629 {
3630 if (player->CanParry())
3631 {
3632 Item* tmpitem = player->GetWeaponForAttack(BASE_ATTACK, true);
3633 if (!tmpitem)
3634 tmpitem = player->GetWeaponForAttack(OFF_ATTACK, true);
3635
3636 if (tmpitem)
3637 chance = player->GetRealParry(); //GetFloatValue(PLAYER_PARRY_PERCENTAGE);
3638 }
3639 }
3640 else if (GetTypeId() == TYPEID_UNIT)
3641 {
3642 if (ToCreature()->isWorldBoss())
3643 chance = 13.4f; // + 0.6 by skill diff
3645 chance = 5.0f;
3646
3647 // Xinef: if aura is present, type should not matter
3649 }
3650
3651 return chance > 0.0f ? chance : 0.0f;
3652}
@ SPELL_AURA_MOD_PARRY_PERCENT
Definition: SpellAuraDefines.h:110

References BASE_ATTACK, CREATURE_TYPE_HUMANOID, GetCreatureType(), GetTotalAuraModifier(), Object::GetTypeId(), OFF_ATTACK, SPELL_AURA_MOD_PARRY_PERCENT, Object::ToCreature(), Object::ToPlayer(), and TYPEID_UNIT.

Referenced by spell_dk_spell_deflection::Absorb(), MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ GetUnitState()

uint32 Unit::GetUnitState ( ) const
inline

◆ GetUnitTypeMask()

uint32 Unit::GetUnitTypeMask ( ) const
inline
750{ return m_unitTypeMask; }

References m_unitTypeMask.

◆ GetVehicle()

Vehicle * Unit::GetVehicle ( ) const
inline
1697{ return m_vehicle; }

References m_vehicle.

Referenced by KillRewarder::_InitXP(), Vehicle::AddPassenger(), WorldSession::BuildPartyMemberStatsChangedPacket(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::CanAIAttack(), npc_raging_spirit::npc_raging_spiritAI::CanAIAttack(), npc_icc_lk_checktarget::npc_icc_lk_checktargetAI::CanAIAttack(), boss_flame_leviathan_defense_turret::boss_flame_leviathan_defense_turretAI::CanAIAttack(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::CheckAchievementCriteriaMeet(), Spell::CheckCast(), Spell::EffectJumpDest(), Spell::EffectKnockBack(), CreatureAI::EnterEvadeMode(), GetDirectTransport(), SmartScript::GetTargets(), GetTransGUID(), WorldSession::HandleAttackSwingOpcode(), WorldSession::HandleChangeSeatsOnControlledVehicle(), spell_switch_infragreen_bomber_station::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), Player::IsPetNeedBeTemporaryUnsummoned(), npc_nexus_lord::npc_nexus_lordAI::JustDied(), npc_scion_of_eternity::npc_scion_of_eternityAI::JustDied(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), achievement_flame_leviathan_garage::OnCheck(), achievement_wg_didnt_stand_a_chance::OnCheck(), npc_announcer_toc5::OnGossipHello(), BattlefieldWG::OnPlayerLeaveWar(), boss_flame_leviathan_overload_device::boss_flame_leviathan_overload_deviceAI::OnSpellClick(), VehicleCheck::operator()(), OutDebugInfo(), Player::ProcessDelayedOperations(), Player::ProcessTerrainStatusUpdate(), Vehicle::RemovePassenger(), Creature::SelectVictim(), SetControlled(), Player::SetViewpoint(), lfg::LFGMgr::TeleportPlayer(), npc_pilgrims_bounty_chair::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_impaling_spear::npc_impaling_spearAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::UpdateAI(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdatePosition(), UpdateSpeed(), GameObject::Use(), Acore::MessageDistDeliverer::Visit(), and Acore::MessageDistDelivererToHostile::Visit().

◆ GetVehicleBase()

◆ GetVehicleCreatureBase()

◆ GetVehicleKit()

Vehicle * Unit::GetVehicleKit ( ) const
inline
1696{ return m_vehicleKit; }

References m_vehicleKit.

Referenced by _EnterVehicle(), Creature::AddToWorld(), Creature::AIM_Initialize(), boss_xt002::boss_xt002AI::AttachHeart(), npc_salvaged_siege_engine::BeforeSpellClick(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::boss_deathbringer_saurfangAI(), spell_igb_cannon_blast::CalculatePower(), Aura::CanStackWith(), spell_demolisher_ride_vehicle::CheckCast(), SmartAI::CheckConditions(), VehicleAI::CheckConditions(), Map::CreatureRelocation(), Dismount(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), npc_ulduar_vx001::npc_ulduar_vx001AI::DoAction(), npc_hover_disk::npc_hover_diskAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), Spell::EffectTeleportUnits(), CreatureAI::EnterEvadeMode(), boss_ick::boss_ickAI::GetKrick(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::GetS3(), SmartScript::GetTargets(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraSetVehicle(), WorldSession::HandleCastSpellOpcode(), spell_q13280_13283_plant_battle_standard::HandleDummy(), WorldSession::HandleEjectPassenger(), spell_q12919_gymers_throw::HandleScript(), HandleSpellClick(), IsOnVehicle(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), boss_gormok::boss_gormokAI::JustEngagedWith(), Mount(), npc_hover_disk::npc_hover_diskAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::MovementInform(), npc_vics_flying_machine::npc_vics_flying_machineAI::MovementInform(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::npc_high_overlord_saurfangAI(), npc_orb_carrier::npc_orb_carrierAI::npc_orb_carrierAI(), spell_systems_shutdown_aura::OnApply(), VehicleAI::OnCharmed(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), FlameLeviathanPursuedTargetSelector::operator()(), OutDebugInfo(), npc_wintergarde_gryphon::PassengerBoarded(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), Map::PlayerRelocation(), SmartScript::ProcessAction(), boss_skadi_grauf::boss_skadi_graufAI::RemoveSkadi(), Spell::SelectImplicitCasterObjectTargets(), SmartAI::SmartAI(), npc_wintergarde_gryphon::SpellHit(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit(), npc_storm_cloud::npc_storm_cloudAI::SpellHit(), boss_flame_leviathan::boss_flame_leviathanAI::SpellHitTarget(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_preparations_for_war_vehicle::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI(), npc_wg_siege_machine::npc_wg_siege_machineAI::UpdateAI(), UpdateHeight(), and UpdateOrientation().

◆ GetVictim()

Unit * Unit::GetVictim ( ) const
inline
727{ return m_attacking; }

References m_attacking.

Referenced by boss_marli::_chargePlayer(), PetAI::_needToStop(), npc_escortAI::AssistPlayerInCombatAgainst(), FollowerAI::AssistPlayerInCombatAgainst(), SmartAI::AssistPlayerInCombatAgainst(), PetAI::AttackedBy(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), boss_malygos::boss_malygosAI::AttackStart(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), Object::BuildMovementUpdate(), Creature::CallAssistance(), Creature::CallForHelp(), TurretAI::CanAIAttack(), PetAI::CanAttack(), boss_attumen::CanMeleeHit(), boss_midnight::CanMeleeHit(), boss_swamplord_muselek::CanShootVictim(), Spell::CheckCast(), boss_mandokir::boss_mandokirAI::DamageDealt(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_dark_nucleus::npc_dark_nucleusAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_leotheras_the_blind::DemonTime(), boss_skadi::boss_skadiAI::DoAction(), UnitAI::DoCast(), UnitAI::DoCastVictim(), ConfusedMovementGenerator< T >::DoFinalize(), Creature::DoFleeToGetAssistance(), UnitAI::DoMeleeAttackIfReady(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), ScriptedAI::DoStopAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectTaunt(), boss_ouro::Emerge(), boss_halazzi::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), RestoreAttack::Execute(), StartMovementEvent::Execute(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::ExecuteEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::ExecuteEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::ExecuteEvent(), emerald_dragonAI::ExecuteEvent(), spell_shazzrah_gate_dummy::FilterTargets(), spell_malchezaar_enfeeble::FilterTargets(), spell_chain_burn::FilterTargets(), spell_morogrim_tidewalker_watery_grave::FilterTargets(), TimedFleeingMovementGenerator::Finalize(), getAttackerForHelper(), ThreatMgr::GetCurrentVictim(), Player::GetInitialVisiblePackets(), CreatureGroup::GetNewTargetForMember(), SmartScript::GetTargets(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), cast_commandscript::HandleCastTargetCommad(), spell_aggro_drones::HandleDummy(), spell_gen_threshalisk_charge::HandleDummy(), HandleDummyAuraProc(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_lurker_below_spout::HandleEffectRemove(), AuraEffect::HandleModPossessPet(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), WorldSession::HandlePetActionHelper(), WorldSession::HandleSetRaidDifficultyOpcode(), ChaseMovementGenerator< T >::HasLostTarget(), Spell::InitExplicitTargets(), RotateMovementGenerator::Initialize(), IsMutualChase(), boss_ouro::IsPlayerWithinMeleeRange(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), npc_malchezaar_axe::JustEngagedWith(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustEngagedWith(), npc_zealot_zath::JustEngagedWith(), npc_yor::JustEngagedWith(), boss_essence_of_anger::boss_essence_of_angerAI::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), npc_thaladred::JustEngagedWith(), boss_nethermancer_sepethrea::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), boss_vem::JustEngagedWith(), boss_veklor::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_midnight::JustSummoned(), boss_nightbane::JustSummoned(), boss_halazzi::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), boss_fathomlord_karathress::JustSummoned(), boss_fathomguard_tidalvess::JustSummoned(), boss_the_black_stalker::JustSummoned(), boss_nethermancer_sepethrea::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), npc_emily::npc_emilyAI::JustSummoned(), PetAI::KilledUnit(), boss_ick::boss_ickAI::KilledUnit(), boss_flame_leviathan::boss_flame_leviathanAI::KilledUnit(), spell_svalna_revive_champion::Land(), CreatureGroup::LeaderMoveTo(), CreatureGroup::MemberEngagingTarget(), SmartAI::MoveAway(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_kerlonian::npc_kerlonianAI::MoveInLineOfSight(), npc_tooga::npc_toogaAI::MoveInLineOfSight(), npc_ringo::npc_ringoAI::MoveInLineOfSight(), boss_gluth::boss_gluthAI::MoveInLineOfSight(), npc_future_you::npc_future_youAI::MoveInLineOfSight(), npc_captain_saeed::npc_captain_saeedAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), boss_nightbane::MovementInform(), boss_bug_trio::MovementInform(), boss_lady_vashj::MovementInform(), boss_nazan::MovementInform(), boss_kaelthas::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_kagani_nightstrike::MovementInform(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), npc_pet_mage_mirror_image::MySelectNextTarget(), NecroticPlagueTargetCheck::operator()(), NonTankTargetSelector::operator()(), BoneStormMoveTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), WebTargetSelector::operator()(), UnboundPlagueTargetSelector::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), boss_nefarian::PathEndReached(), SmartScript::ProcessEvent(), SmartScript::ProcessEventsFor(), SmartScript::ProcessTimedAction(), npc_mograine::npc_mograineAI::PullCathedral(), boss_grobbulus::boss_grobbulusAI::PullChamberAdds(), Creature::ReleaseFocus(), boss_leotheras_the_blind::Reset(), boss_magtheridon::Reset(), npc_pet_hunter_snake_trap::Reset(), Creature::ResumeChasingVictim(), boss_high_botanist_freywinn::ResumeEncounter(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), boss_nightbane::ScheduleFly(), boss_the_lurker_below::SchedulerPhaseOne(), npc_giant_claw_tentacle::ScheduleTasks(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), PetAI::SelectNextTarget(), UnitAI::SelectTargetList(), SmartAI::SetCombatMove(), SetConfused(), SetFeared(), SetStunned(), boss_murmur::ShouldCastResonance(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), boss_quartermaster_zigris::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::SpellHitTarget(), npc_escortAI::Start(), FollowerAI::StartFollow(), StopAttackFaction(), StopAttackingInvalidTarget(), SummonCroneIfReady(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_dorothee::SummonTito(), TauntApply(), TauntFadeOut(), npc_daphne_stilwell::npc_daphne_stilwellAI::Update(), Pet::Update(), Creature::Update(), Player::Update(), CasterAI::UpdateAI(), ArcherAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_escortAI::UpdateAI(), boss_general_angerforge::boss_general_angerforgeAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_broodlord::boss_broodlordAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_felblood_kaelthas::UpdateAI(), boss_kagani_nightstrike::UpdateAI(), boss_ellris_duskhallow::UpdateAI(), boss_eramas_brightblaze::UpdateAI(), boss_yazzai::UpdateAI(), boss_warlord_salaris::UpdateAI(), boss_garaxxas::UpdateAI(), boss_zelfan::UpdateAI(), boss_selin_fireheart::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_brutallus::boss_brutallusAI::UpdateAI(), boss_sacrolash::boss_sacrolashAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_fenstalker::boss_fenstalkerAI::UpdateAI(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_skeram::UpdateAI(), npc_muglash::npc_muglashAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), npc_twilight_summon::npc_twilight_summonAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_toc_shaman::npc_toc_shamanAI::UpdateAI(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::UpdateAI(), npc_toc_warlock::npc_toc_warlockAI::UpdateAI(), npc_toc_mage::npc_toc_mageAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), npc_toc_boomkin::npc_toc_boomkinAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::UpdateAI(), npc_toc_pet_hunter::npc_toc_pet_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_spirit_warden::npc_spirit_wardenAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), npc_boss_gothik_minion::npc_boss_gothik_minionAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), npc_auriaya_sanctum_sentry::npc_auriaya_sanctum_sentryAI::UpdateAI(), npc_auriaya_feral_defender::npc_auriaya_feral_defenderAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_watcher::npc_ulduar_dark_rune_watcherAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_xt002_pummeller::npc_xt002_pummellerAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_keleseth::boss_kelesethAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), npc_azure_invader::npc_azure_invaderAI::UpdateAI(), npc_azure_raider::npc_azure_raiderAI::UpdateAI(), npc_azure_captain::npc_azure_captainAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_wounded_skirmisher::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_high_nethermancer_zerevor::UpdateAI(), boss_lady_malande::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), guard_shattrath_scryer::guard_shattrath_scryerAI::UpdateAI(), guard_shattrath_aldor::guard_shattrath_aldorAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), PossessedAI::UpdateAI(), PetAI::UpdateAI(), FollowerAI::UpdateAI(), npc_zuljin_vortex::npc_zuljin_vortexAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), npc_xt002_life_spark::npc_xt002_life_sparkAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), npc_pet_gen_gnomish_flame_turret::UpdateAI(), Player::UpdateCharmedAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), Player::UpdateFFAPvPFlag(), Player::UpdateFFAPvPState(), SmartAI::UpdatePath(), boss_netherspite::UpdatePortals(), CreatureAI::UpdateVictim(), CreatureAI::UpdateVictimWithGaze(), and boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UseAbility().

◆ GetVisibleAura()

AuraApplication * Unit::GetVisibleAura ( uint8  slot)
inline
1496 {
1497 VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
1498 if (itr != m_visibleAuras.end())
1499 return itr->second;
1500 return nullptr;
1501 }

References m_visibleAuras.

Referenced by WorldSession::BuildPartyMemberStatsChangedPacket(), AuraApplication::BuildUpdatePacket(), and WorldSession::HandleRequestPartyMemberStatsOpcode().

◆ GetVisibleAuras()

◆ GetWeaponDamageRange()

float Unit::GetWeaponDamageRange ( WeaponAttackType  attType,
WeaponDamageRange  type,
uint8  damageIndex = 0 
) const
15380{
15381 if (attType == OFF_ATTACK && !haveOffhandWeapon())
15382 return 0.0f;
15383
15384 return m_weaponDamage[attType][type][damageIndex];
15385}

References haveOffhandWeapon(), m_weaponDamage, and OFF_ATTACK.

Referenced by Player::_ApplyWeaponDamage(), Creature::CalculateMinMaxDamage(), Player::CalculateMinMaxDamage(), and Guardian::UpdateDamagePhysical().

◆ GetWeaponProcChance()

float Unit::GetWeaponProcChance ( ) const
13376{
13377 // normalized proc chance for weapon attack speed
13378 // (odd formula...)
13380 return (GetAttackTime(BASE_ATTACK) * 1.8f / 1000.0f);
13382 return (GetAttackTime(OFF_ATTACK) * 1.6f / 1000.0f);
13383 return 0;
13384}

References BASE_ATTACK, GetAttackTime(), haveOffhandWeapon(), isAttackReady(), and OFF_ATTACK.

Referenced by Player::CastItemCombatSpell().

◆ GetWeaponSkillValue()

uint32 Unit::GetWeaponSkillValue ( WeaponAttackType  attType,
Unit const *  target = nullptr 
) const
3758{
3759 uint32 value = 0;
3760 if (Player const* player = ToPlayer())
3761 {
3762 Item* item = player->GetWeaponForAttack(attType, true);
3763
3764 // feral or unarmed skill only for base attack
3765 if (attType != BASE_ATTACK && !item)
3766 return 0;
3767
3768 if (IsInFeralForm())
3769 return GetMaxSkillValueForLevel(); // always maximized SKILL_FERAL_COMBAT in fact
3770
3771 // weapon skill or (unarmed for base attack)
3772 uint32 skill = SKILL_UNARMED;
3773 if (item)
3774 skill = item->GetSkill();
3775
3776 // in PvP use full skill instead current skill value
3777 value = (target && target->IsControlledByPlayer())
3778 ? player->GetMaxSkillValue(skill)
3779 : player->GetSkillValue(skill);
3780 // Modify value from ratings
3781 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL));
3782 switch (attType)
3783 {
3784 case BASE_ATTACK:
3785 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_MAINHAND));
3786 break;
3787 case OFF_ATTACK:
3788 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_OFFHAND));
3789 break;
3790 case RANGED_ATTACK:
3791 value += uint32(player->GetRatingBonusValue(CR_WEAPON_SKILL_RANGED));
3792 break;
3793 default:
3794 break;
3795 }
3796 }
3797 else
3798 value = GetUnitMeleeSkill(target);
3799 return value;
3800}
@ CR_WEAPON_SKILL_RANGED
Definition: Unit.h:239
@ CR_WEAPON_SKILL
Definition: Unit.h:217
@ CR_WEAPON_SKILL_OFFHAND
Definition: Unit.h:238
@ CR_WEAPON_SKILL_MAINHAND
Definition: Unit.h:237
@ SKILL_UNARMED
Definition: SharedDefines.h:2907
uint32 GetSkill()
Definition: Item.cpp:556
bool IsInFeralForm() const
Definition: Unit.h:1420

References BASE_ATTACK, CR_WEAPON_SKILL, CR_WEAPON_SKILL_MAINHAND, CR_WEAPON_SKILL_OFFHAND, CR_WEAPON_SKILL_RANGED, GetMaxSkillValueForLevel(), Item::GetSkill(), GetUnitMeleeSkill(), IsControlledByPlayer(), IsInFeralForm(), OFF_ATTACK, RANGED_ATTACK, SKILL_UNARMED, and Object::ToPlayer().

Referenced by isSpellBlocked(), MeleeSpellHitResult(), RollMeleeOutcomeAgainst(), and Player::UpdateCritPercentage().

◆ HandleAuraProc()

bool Unit::HandleAuraProc ( Unit victim,
uint32  damage,
Aura triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
bool *  handled 
)
private
8682{
8683 SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
8684
8685 switch (dummySpell->SpellFamilyName)
8686 {
8688 switch (dummySpell->Id)
8689 {
8690 // Nevermelting Ice Crystal
8691 case 71564:
8692 RemoveAuraFromStack(71564);
8693 *handled = true;
8694 break;
8695 // Gaseous Bloat
8696 case 70672:
8697 case 72455:
8698 case 72832:
8699 case 72833:
8700 {
8701 if (Unit* caster = triggeredByAura->GetCaster())
8702 if (victim && caster->GetGUID() == victim->GetGUID())
8703 {
8704 *handled = true;
8705 uint32 stack = triggeredByAura->GetStackAmount();
8706 int32 const mod = (GetMap()->GetSpawnMode() & 1) ? 1500 : 1250;
8707 int32 dmg = 0;
8708 for (uint8 i = 1; i <= stack; ++i)
8709 dmg += mod * i;
8710 caster->CastCustomSpell(70701, SPELLVALUE_BASE_POINT0, dmg);
8711 }
8712 break;
8713 }
8714 // Ball of Flames Proc
8715 case 71756:
8716 case 72782:
8717 case 72783:
8718 case 72784:
8719 RemoveAuraFromStack(dummySpell->Id);
8720 *handled = true;
8721 break;
8722 // Discerning Eye of the Beast
8723 case 59915:
8724 {
8725 CastSpell(this, 59914, true); // 59914 already has correct basepoints in DBC, no need for custom bp
8726 *handled = true;
8727 break;
8728 }
8729 // Swift Hand of Justice
8730 case 59906:
8731 {
8732 int32 bp0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_0]. CalcValue());
8733 CastCustomSpell(this, 59913, &bp0, nullptr, nullptr, true);
8734 *handled = true;
8735 break;
8736 }
8737 }
8738
8739 break;
8740 case SPELLFAMILY_MAGE:
8741 {
8742 // Combustion
8743 switch (dummySpell->Id)
8744 {
8745 case 11129:
8746 {
8747 *handled = true;
8748 Unit* caster = triggeredByAura->GetCaster();
8749 if (!caster || !damage)
8750 return false;
8751
8752 // last charge and crit
8753 if (triggeredByAura->GetCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT))
8754 return true; // charge counting (will removed)
8755
8756 CastSpell(this, 28682, true);
8757
8758 return procEx & PROC_EX_CRITICAL_HIT;
8759 }
8760 // Empowered Fire
8761 case 31656:
8762 case 31657:
8763 case 31658:
8764 {
8765 *handled = true;
8766
8767 SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(67545);
8768 if (!spInfo)
8769 return false;
8770
8771 int32 bp0 = int32(CalculatePct(GetMaxPower(POWER_MANA), spInfo->Effects[0].CalcValue()));
8772 CastCustomSpell(this, 67545, &bp0, nullptr, nullptr, true, nullptr, triggeredByAura->GetEffect(EFFECT_0), GetGUID());
8773 return true;
8774 }
8775 }
8776 break;
8777 }
8779 {
8780 // Blood of the North
8781 // Reaping
8782 // Death Rune Mastery
8783 // xinef: Icon 22 is used for item bonus, skip
8784 if (dummySpell->SpellIconID == 3041 || (dummySpell->SpellIconID == 22 && dummySpell->Id != 62459) || dummySpell->SpellIconID == 2622)
8785 {
8786 *handled = true;
8787 // Convert recently used Blood Rune to Death Rune
8788 if (Player* player = ToPlayer())
8789 {
8790 if (!player->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY))
8791 return false;
8792
8793 // xinef: not true
8794 //RuneType rune = ToPlayer()->GetLastUsedRune();
8795 // can't proc from death rune use
8796 //if (rune == RUNE_DEATH)
8797 // return false;
8798 AuraEffect* aurEff = triggeredByAura->GetEffect(EFFECT_0);
8799 if (!aurEff)
8800 return false;
8801
8802 // Reset amplitude - set death rune remove timer to 30s
8803 aurEff->ResetPeriodic(true);
8804 uint32 runesLeft;
8805
8806 if (dummySpell->SpellIconID == 2622)
8807 runesLeft = 2;
8808 else
8809 runesLeft = 1;
8810
8811 for (uint8 i = 0; i < MAX_RUNES && runesLeft; ++i)
8812 {
8813 if (dummySpell->SpellIconID == 2622)
8814 {
8815 if (player->GetCurrentRune(i) == RUNE_DEATH ||
8816 player->GetBaseRune(i) == RUNE_BLOOD)
8817 continue;
8818 }
8819 else
8820 {
8821 if (player->GetCurrentRune(i) == RUNE_DEATH ||
8822 player->GetBaseRune(i) != RUNE_BLOOD)
8823 continue;
8824 }
8825 if (player->GetRuneCooldown(i) != player->GetRuneBaseCooldown(i, false))
8826 continue;
8827
8828 --runesLeft;
8829 // Mark aura as used
8830 player->AddRuneByAuraEffect(i, RUNE_DEATH, aurEff);
8831 }
8832 return true;
8833 }
8834 return false;
8835 }
8836 break;
8837 }
8839 {
8840 switch (dummySpell->Id)
8841 {
8842 // Item - Warrior T10 Protection 4P Bonus
8843 case 70844:
8844 {
8845 int32 basepoints0 = CalculatePct(GetMaxHealth(), dummySpell->Effects[EFFECT_1]. CalcValue());
8846 CastCustomSpell(this, 70845, &basepoints0, nullptr, nullptr, true);
8847 break;
8848 }
8849 default:
8850 break;
8851 }
8852 break;
8853 }
8854 case SPELLFAMILY_SHAMAN:
8855 {
8856 // Flurry
8857 if ((dummySpell->SpellFamilyFlags[1] & 0x00000200) != 0)
8858 {
8859 if (cooldown)
8860 {
8861 if (HasSpellCooldown(dummySpell->Id))
8862 {
8863 *handled = true;
8864 break;
8865 }
8866
8867 AddSpellCooldown(dummySpell->Id, 0, cooldown);
8868 }
8869 }
8870 break;
8871 }
8872 }
8873 return false;
8874}
@ RUNE_DEATH
Definition: Player.h:412
@ RUNE_BLOOD
Definition: Player.h:409
@ EFFECT_1
Definition: SharedDefines.h:32
@ EFFECT_0
Definition: SharedDefines.h:31
@ SPELLFAMILY_MAGE
Definition: SharedDefines.h:3531
@ SPELLFAMILY_GENERIC
Definition: SharedDefines.h:3528
@ SPELLFAMILY_WARRIOR
Definition: SharedDefines.h:3532
@ SPELLFAMILY_SHAMAN
Definition: SharedDefines.h:3539
@ SPELLFAMILY_DEATHKNIGHT
Definition: SharedDefines.h:3543
virtual bool HasSpellCooldown(uint32) const
Definition: Unit.h:1761
virtual void AddSpellCooldown(uint32, uint32, uint32, bool needSendToClient=false, bool forceSendToSpectator=false)
Definition: Unit.h:1763
void RemoveAuraFromStack(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4887
uint8 GetSpawnMode() const
Definition: Map.h:420
void ResetPeriodic(bool resetPeriodicTimer=false)
Definition: SpellAuraEffects.h:89
AuraEffect * GetEffect(uint8 effIndex) const
Definition: SpellAuras.h:175

References AddSpellCooldown(), CalculatePct(), CastCustomSpell(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, EFFECT_0, EFFECT_1, SpellInfo::Effects, Aura::GetCaster(), Aura::GetCharges(), Aura::GetEffect(), Object::GetGUID(), WorldObject::GetMap(), GetMaxHealth(), GetMaxPower(), Map::GetSpawnMode(), Aura::GetSpellInfo(), Aura::GetStackAmount(), HasSpellCooldown(), SpellInfo::Id, MAX_RUNES, POWER_MANA, PROC_EX_CRITICAL_HIT, RemoveAuraFromStack(), AuraEffect::ResetPeriodic(), RUNE_BLOOD, RUNE_DEATH, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_GENERIC, SPELLFAMILY_MAGE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SPELLVALUE_BASE_POINT0, sSpellMgr, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleAuraRaidProcFromCharge()

bool Unit::HandleAuraRaidProcFromCharge ( AuraEffect triggeredByAura)
private
17569{
17570 // aura can be deleted at casts
17571 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
17572
17573 uint32 damageSpellId;
17574 switch (spellProto->Id)
17575 {
17576 case 57949: // shiver
17577 damageSpellId = 57952;
17578 //animationSpellId = 57951; dummy effects for jump spell have unknown use (see also 41637)
17579 break;
17580 case 59978: // shiver
17581 damageSpellId = 59979;
17582 break;
17583 case 43593: // Cold Stare
17584 damageSpellId = 43594;
17585 break;
17586 default:
17587 LOG_ERROR("entities.unit", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: {}", spellProto->Id);
17588 return false;
17589 }
17590
17591 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
17592
17593 // jumps
17594 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
17595
17596 // current aura expire
17597 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
17598
17599 // next target selection
17600 if (jumps > 0)
17601 {
17602 if (Unit* caster = triggeredByAura->GetCaster())
17603 {
17604 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
17605 if (Unit* target = GetNextRandomRaidMemberOrPet(radius))
17606 {
17607 CastSpell(target, spellProto, true, nullptr, triggeredByAura, caster_guid);
17608 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
17609 aura->SetCharges(jumps);
17610 }
17611 }
17612 }
17613
17614 CastSpell(this, damageSpellId, true, nullptr, triggeredByAura, caster_guid);
17615
17616 return true;
17617}
Unit * GetNextRandomRaidMemberOrPet(float radius)
Definition: Unit.cpp:11049
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:952

References CastSpell(), SpellInfo::Effects, AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), GetNextRandomRaidMemberOrPet(), AuraEffect::GetSpellInfo(), SpellInfo::Id, LOG_ERROR, and Aura::SetCharges().

Referenced by ProcDamageAndSpellFor().

◆ HandleAuraRaidProcFromChargeWithValue()

bool Unit::HandleAuraRaidProcFromChargeWithValue ( AuraEffect triggeredByAura)
private
17480{
17481 // aura can be deleted at casts
17482 SpellInfo const* spellProto = triggeredByAura->GetSpellInfo();
17483 int32 heal = triggeredByAura->GetAmount();
17484 ObjectGuid caster_guid = triggeredByAura->GetCasterGUID();
17485
17486 // Currently only Prayer of Mending
17487 if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20))
17488 {
17489 LOG_DEBUG("spells.aura", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: {}", spellProto->Id);
17490 return false;
17491 }
17492
17493 // jumps
17494 int32 jumps = triggeredByAura->GetBase()->GetCharges() - 1;
17495
17496 // current aura expire
17497 triggeredByAura->GetBase()->SetCharges(1); // will removed at next charges decrease
17498
17499 // next target selection
17500 if (jumps > 0)
17501 {
17502 if (Unit* caster = triggeredByAura->GetCaster())
17503 {
17504 // smart healing
17505 float radius = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcRadius(caster);
17506 std::list<Unit*> nearMembers;
17507
17508 Player* player = nullptr;
17509 if (IsPlayer())
17510 player = ToPlayer();
17511 else if (GetOwner())
17512 player = GetOwner()->ToPlayer();
17513
17514 if (player)
17515 {
17516 Group* group = player->GetGroup();
17517 if (!group)
17518 {
17519 if (player != this)
17520 {
17521 if (IsWithinDistInMap(player, radius))
17522 nearMembers.push_back(player);
17523 }
17524 else if (Unit* pet = GetGuardianPet())
17525 {
17526 if (IsWithinDistInMap(pet, radius))
17527 nearMembers.push_back(pet);
17528 }
17529 }
17530 else
17531 {
17532 for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
17533 if (Player* Target = itr->GetSource())
17534 {
17535 if (Target != this && !IsWithinDistInMap(Target, radius))
17536 continue;
17537
17538 // IsHostileTo check duel and controlled by enemy
17539 if (Target != this && Target->IsAlive() && !IsHostileTo(Target))
17540 nearMembers.push_back(Target);
17541
17542 // Push player's pet to vector
17543 if (Unit* pet = Target->GetGuardianPet())
17544 if (pet != this && pet->IsAlive() && IsWithinDistInMap(pet, radius) && !IsHostileTo(pet))
17545 nearMembers.push_back(pet);
17546 }
17547 }
17548
17549 if (!nearMembers.empty())
17550 {
17551 nearMembers.sort(Acore::HealthPctOrderPred());
17552 if (Unit* target = nearMembers.front())
17553 {
17554 CastSpell(target, 41637 /*Dummy visual effect triggered by main spell cast*/, true);
17555 CastCustomSpell(target, spellProto->Id, &heal, nullptr, nullptr, true, nullptr, triggeredByAura, caster_guid);
17556 if (Aura* aura = target->GetAura(spellProto->Id, caster->GetGUID()))
17557 aura->SetCharges(jumps);
17558 }
17559 }
17560 }
17561 }
17562 }
17563
17564 // heal
17565 CastCustomSpell(this, 33110, &heal, nullptr, nullptr, true, nullptr, nullptr, caster_guid);
17566 return true;
17567}
@ SPELLFAMILY_PRIEST
Definition: SharedDefines.h:3534
Definition: Unit.h:1981

References CastCustomSpell(), CastSpell(), SpellInfo::Effects, AuraEffect::GetAmount(), AuraEffect::GetBase(), AuraEffect::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCharges(), AuraEffect::GetEffIndex(), Group::GetFirstMember(), Player::GetGroup(), GetGuardianPet(), GetOwner(), AuraEffect::GetSpellInfo(), SpellInfo::Id, IsHostileTo(), Object::IsPlayer(), WorldObject::IsWithinDistInMap(), LOG_DEBUG, GroupReference::next(), Aura::SetCharges(), SPELLFAMILY_PRIEST, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleDummyAuraProc()

bool Unit::HandleDummyAuraProc ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
ProcEventInfo const &  eventInfo 
)
private
Todo:
: It should be moved to database, shouldn't it?
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
Todo:
: need more info (cooldowns/PPM)
6541{
6542 SpellInfo const* dummySpell = triggeredByAura->GetSpellInfo();
6543 uint32 effIndex = triggeredByAura->GetEffIndex();
6544 int32 triggerAmount = triggeredByAura->GetAmount();
6545 Spell const* spellProc = eventInfo.GetProcSpell();
6546
6547 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer()
6548 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
6549
6550 uint32 triggered_spell_id = 0;
6551 uint32 cooldown_spell_id = 0; // for random trigger, will be one of the triggered spell to avoid repeatable triggers
6552 // otherwise, it's the triggered_spell_id by default
6553 Unit* target = victim;
6554 int32 basepoints0 = 0;
6555 ObjectGuid originalCaster;
6556
6557 switch (dummySpell->SpellFamilyName)
6558 {
6560 {
6561 switch (dummySpell->Id)
6562 {
6563 // Overkill
6564 case 58426:
6565 {
6566 triggered_spell_id = 58427;
6567 break;
6568 }
6569 // Unstable Power
6570 case 24658:
6571 {
6572 if (!procSpell || procSpell->Id == 24659)
6573 return false;
6574 // Need remove one 24659 aura
6575 RemoveAuraFromStack(24659);
6576 return true;
6577 }
6578 // Restless Strength
6579 case 24661:
6580 {
6581 // Need remove one 24662 aura
6582 RemoveAuraFromStack(24662);
6583 return true;
6584 }
6585 // Mark of Malice
6586 case 33493:
6587 {
6588 if (triggeredByAura->GetBase()->GetCharges() > 1)
6589 return true;
6590
6591 target = this;
6592 triggered_spell_id = 33494;
6593 break;
6594 }
6595 // Twisted Reflection (boss spell)
6596 case 21063:
6597 triggered_spell_id = 21064;
6598 break;
6599 // Vampiric Aura (boss spell)
6600 case 38196:
6601 {
6602 basepoints0 = 3 * damage; // 300%
6603 if (basepoints0 < 0)
6604 return false;
6605
6606 triggered_spell_id = 31285;
6607 target = this;
6608 break;
6609 }
6610 // Aura of Madness (Darkmoon Card: Madness trinket)
6611 //=====================================================
6612 // 39511 Sociopath: +35 strength (Paladin, Rogue, Druid, Warrior)
6613 // 40997 Delusional: +70 attack power (Rogue, Hunter, Paladin, Warrior, Druid)
6614 // 40998 Kleptomania: +35 agility (Warrior, Rogue, Paladin, Hunter, Druid)
6615 // 40999 Megalomania: +41 damage/healing (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6616 // 41002 Paranoia: +35 spell/melee/ranged crit strike rating (All classes)
6617 // 41005 Manic: +35 haste (spell, melee and ranged) (All classes)
6618 // 41009 Narcissism: +35 intellect (Druid, Shaman, Priest, Warlock, Mage, Paladin, Hunter)
6619 // 41011 Martyr Complex: +35 stamina (All classes)
6620 // 41406 Dementia: Every 5 seconds either gives you +5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6621 // 41409 Dementia: Every 5 seconds either gives you -5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin)
6622 case 39446:
6623 {
6624 if (GetTypeId() != TYPEID_PLAYER || !IsAlive())
6625 return false;
6626
6627 // Select class defined buff
6628 switch (getClass())
6629 {
6630 case CLASS_PALADIN: // 39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409
6631 case CLASS_DRUID: // 39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409
6632 triggered_spell_id = RAND(39511, 40997, 40998, 40999, 41002, 41005, 41009, 41011, 41409);
6633 cooldown_spell_id = 39511;
6634 break;
6635 case CLASS_ROGUE: // 39511, 40997, 40998, 41002, 41005, 41011
6636 case CLASS_WARRIOR: // 39511, 40997, 40998, 41002, 41005, 41011
6637 case CLASS_DEATH_KNIGHT:
6638 triggered_spell_id = RAND(39511, 40997, 40998, 41002, 41005, 41011);
6639 cooldown_spell_id = 39511;
6640 break;
6641 case CLASS_PRIEST: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6642 case CLASS_SHAMAN: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6643 case CLASS_MAGE: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6644 case CLASS_WARLOCK: // 40999, 41002, 41005, 41009, 41011, 41406, 41409
6645 triggered_spell_id = RAND(40999, 41002, 41005, 41009, 41011, 41406, 41409);
6646 cooldown_spell_id = 40999;
6647 break;
6648 case CLASS_HUNTER: // 40997, 40999, 41002, 41005, 41009, 41011, 41406, 41409
6649 triggered_spell_id = RAND(40997, 40999, 41002, 41005, 41009, 41011, 41406, 41409);
6650 cooldown_spell_id = 40997;
6651 break;
6652 default:
6653 return false;
6654 }
6655
6656 target = this;
6657 if (roll_chance_i(10))
6658 ToPlayer()->Say("This is Madness!", LANG_UNIVERSAL);
6659 break;
6660 }
6661 // Sunwell Exalted Caster Neck (??? neck)
6662 // cast ??? Light's Wrath if Exalted by Aldor
6663 // cast ??? Arcane Bolt if Exalted by Scryers
6664 case 46569:
6665 return false; // old unused version
6666 // Sunwell Exalted Caster Neck (Shattered Sun Pendant of Acumen neck)
6667 // cast 45479 Light's Wrath if Exalted by Aldor
6668 // cast 45429 Arcane Bolt if Exalted by Scryers
6669 case 45481:
6670 {
6671 Player* player = ToPlayer();
6672 if (!player)
6673 return false;
6674
6675 // Get Aldor reputation rank
6676 if (player->GetReputationRank(932) == REP_EXALTED)
6677 {
6678 target = this;
6679 triggered_spell_id = 45479;
6680 break;
6681 }
6682 // Get Scryers reputation rank
6683 if (player->GetReputationRank(934) == REP_EXALTED)
6684 {
6685 // triggered at positive/self casts also, current attack target used then
6686 if (target && IsFriendlyTo(target))
6687 {
6688 target = GetVictim();
6689 if (!target)
6690 {
6691 target = player->GetSelectedUnit();
6692 if (!target)
6693 return false;
6694 }
6695 if (IsFriendlyTo(target))
6696 return false;
6697 }
6698
6699 triggered_spell_id = 45429;
6700 break;
6701 }
6702 return false;
6703 }
6704 // Sunwell Exalted Melee Neck (Shattered Sun Pendant of Might neck)
6705 // cast 45480 Light's Strength if Exalted by Aldor
6706 // cast 45428 Arcane Strike if Exalted by Scryers
6707 case 45482:
6708 {
6709 if (GetTypeId() != TYPEID_PLAYER)
6710 return false;
6711
6712 // Get Aldor reputation rank
6713 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6714 {
6715 target = this;
6716 triggered_spell_id = 45480;
6717 break;
6718 }
6719 // Get Scryers reputation rank
6720 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6721 {
6722 triggered_spell_id = 45428;
6723 break;
6724 }
6725 return false;
6726 }
6727 // Sunwell Exalted Tank Neck (Shattered Sun Pendant of Resolve neck)
6728 // cast 45431 Arcane Insight if Exalted by Aldor
6729 // cast 45432 Light's Ward if Exalted by Scryers
6730 case 45483:
6731 {
6732 if (GetTypeId() != TYPEID_PLAYER)
6733 return false;
6734
6735 // Get Aldor reputation rank
6736 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6737 {
6738 target = this;
6739 triggered_spell_id = 45432;
6740 break;
6741 }
6742 // Get Scryers reputation rank
6743 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6744 {
6745 target = this;
6746 triggered_spell_id = 45431;
6747 break;
6748 }
6749 return false;
6750 }
6751 // Sunwell Exalted Healer Neck (Shattered Sun Pendant of Restoration neck)
6752 // cast 45478 Light's Salvation if Exalted by Aldor
6753 // cast 45430 Arcane Surge if Exalted by Scryers
6754 case 45484:
6755 {
6756 if (GetTypeId() != TYPEID_PLAYER)
6757 return false;
6758
6759 // Get Aldor reputation rank
6760 if (ToPlayer()->GetReputationRank(932) == REP_EXALTED)
6761 {
6762 target = this;
6763 triggered_spell_id = 45478;
6764 break;
6765 }
6766 // Get Scryers reputation rank
6767 if (ToPlayer()->GetReputationRank(934) == REP_EXALTED)
6768 {
6769 triggered_spell_id = 45430;
6770 break;
6771 }
6772 return false;
6773 }
6774 // Kill command
6775 case 58914:
6776 {
6777 // Remove aura stack from pet
6778 RemoveAuraFromStack(58914);
6779 Unit* owner = GetOwner();
6780 if (!owner)
6781 return true;
6782 // reduce the owner's aura stack
6783 owner->RemoveAuraFromStack(34027);
6784 return true;
6785 }
6786 // Vampiric Touch (generic, used by some boss)
6787 case 52723:
6788 case 60501:
6789 {
6790 triggered_spell_id = 52724;
6791 basepoints0 = damage / 2;
6792 target = this;
6793 break;
6794 }
6795 // Divine purpose
6796 case 31871:
6797 case 31872:
6798 {
6799 // Roll chane
6800 if (!victim || !victim->IsAlive() || !roll_chance_i(triggerAmount))
6801 return false;
6802
6803 // Remove any stun effect on target
6805 return true;
6806 }
6807 // Glyph of Life Tap
6808 case 63320:
6809 {
6810 triggered_spell_id = 63321; // Life Tap
6811 break;
6812 }
6813 case 71519: // Deathbringer's Will Normal
6814 {
6815 if (GetTypeId() != TYPEID_PLAYER || HasSpellCooldown(71484))
6816 return false;
6817
6818 AddSpellCooldown(71484, 0, cooldown);
6819
6820 std::vector<uint32> RandomSpells;
6821 switch (getClass())
6822 {
6823 case CLASS_WARRIOR:
6824 case CLASS_PALADIN:
6825 case CLASS_DEATH_KNIGHT:
6826 RandomSpells.push_back(71484);
6827 RandomSpells.push_back(71491);
6828 RandomSpells.push_back(71492);
6829 break;
6830 case CLASS_SHAMAN:
6831 case CLASS_ROGUE:
6832 RandomSpells.push_back(71486);
6833 RandomSpells.push_back(71485);
6834 RandomSpells.push_back(71492);
6835 break;
6836 case CLASS_DRUID:
6837 RandomSpells.push_back(71484);
6838 RandomSpells.push_back(71485);
6839 RandomSpells.push_back(71492);
6840 break;
6841 case CLASS_HUNTER:
6842 RandomSpells.push_back(71486);
6843 RandomSpells.push_back(71491);
6844 RandomSpells.push_back(71485);
6845 break;
6846 default:
6847 return false;
6848 }
6849 if (RandomSpells.empty()) // shouldn't happen
6850 return false;
6851
6852 uint8 rand_spell = irand(0, (RandomSpells.size() - 1));
6853 CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster);
6854 break;
6855 }
6856 case 71562: // Deathbringer's Will Heroic
6857 {
6858 if (GetTypeId() != TYPEID_PLAYER || HasSpellCooldown(71561))
6859 return false;
6860
6861 AddSpellCooldown(71561, 0, cooldown);
6862
6863 std::vector<uint32> RandomSpells;
6864 switch (getClass())
6865 {
6866 case CLASS_WARRIOR:
6867 case CLASS_PALADIN:
6868 case CLASS_DEATH_KNIGHT:
6869 RandomSpells.push_back(71561);
6870 RandomSpells.push_back(71559);
6871 RandomSpells.push_back(71560);
6872 break;
6873 case CLASS_SHAMAN:
6874 case CLASS_ROGUE:
6875 RandomSpells.push_back(71558);
6876 RandomSpells.push_back(71556);
6877 RandomSpells.push_back(71560);
6878 break;
6879 case CLASS_DRUID:
6880 RandomSpells.push_back(71561);
6881 RandomSpells.push_back(71556);
6882 RandomSpells.push_back(71560);
6883 break;
6884 case CLASS_HUNTER:
6885 RandomSpells.push_back(71558);
6886 RandomSpells.push_back(71559);
6887 RandomSpells.push_back(71556);
6888 break;
6889 default:
6890 return false;
6891 }
6892 if (RandomSpells.empty()) // shouldn't happen
6893 return false;
6894
6895 uint8 rand_spell = irand(0, (RandomSpells.size() - 1));
6896 CastSpell(target, RandomSpells[rand_spell], true, castItem, triggeredByAura, originalCaster);
6897 break;
6898 }
6899 // Freya, Petrified Bark
6900 case 62933:
6901 case 62337:
6902 {
6903 if (!victim)
6904 return false;
6905
6906 int32 dmg = damage;
6907 victim->CastCustomSpell(this, 62379, &dmg, 0, 0, true);
6908 return true;
6909 }
6910 // Trial of the Champion, Earth Shield
6911 case 67534:
6912 {
6913 const int32 dmg = (int32)damage;
6914 CastCustomSpell(this, 67535, &dmg, nullptr, nullptr, true, 0, triggeredByAura, triggeredByAura->GetCasterGUID());
6915 return true;
6916 }
6917 // Trial of the Crusader, Faction Champions, Retaliation
6918 case 65932:
6919 {
6920 // check attack comes not from behind
6921 if (!victim || !HasInArc(M_PI, victim))
6922 return false;
6923
6924 triggered_spell_id = 65934;
6925 break;
6926 }
6927 // Pit of Saron, Tyrannus, Overlord's Brand
6928 case 69172: // everything except for DoTs
6929 {
6930 if (!target)
6931 return false;
6932 if (Unit* caster = triggeredByAura->GetCaster())
6933 {
6935 {
6936 int32 dmg = 5.5f * damage;
6937 target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true);
6938 }
6939 else
6940 {
6941 if (caster->GetVictim())
6942 {
6943 int32 dmg = damage;
6944 target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true);
6945 }
6946 }
6947 }
6948 return true;
6949 }
6950 // Pit of Saron, Tyrannus, Overlord's Brand
6951 case 69173: // only DoTs
6952 {
6953 if (!target)
6954 return false;
6955 if (Unit* caster = triggeredByAura->GetCaster())
6956 {
6957 if (procEx & PROC_EX_INTERNAL_HOT)
6958 {
6959 int32 dmg = 5.5f * damage;
6960 target->CastCustomSpell(caster, 69190, &dmg, 0, 0, true);
6961 }
6962 else
6963 {
6964 if (caster->GetVictim())
6965 {
6966 int32 dmg = damage;
6967 target->CastCustomSpell(caster->GetVictim(), 69189, &dmg, 0, 0, true);
6968 }
6969 }
6970 }
6971 return true;
6972 }
6973 // Icecrown Citadel, Lady Deathwhisper, Vampiric Might
6974 case 70674:
6975 {
6976 if (Unit* caster = triggeredByAura->GetCaster())
6977 {
6978 int32 dmg = 3 * damage;
6979 caster->CastCustomSpell(caster, 70677, &dmg, 0, 0, true);
6980 }
6981 return true;
6982 }
6983 // Item: Purified Shard of the Gods
6984 case 69755:
6985 {
6986 triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69733 : 69729);
6987 break;
6988 }
6989 // Item: Shiny Shard of the Gods
6990 case 69739:
6991 {
6992 triggered_spell_id = ((procFlag & PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS) ? 69734 : 69730);
6993 break;
6994 }
6995 // VoA: Meteor Fists koralon
6996 case 66725:
6997 case 68161:
6998 {
6999 triggered_spell_id = 66765; // handled by spell_difficulty
7000 break;
7001 }
7002 }
7003 break;
7004 }
7005 case SPELLFAMILY_MAGE:
7006 {
7007 // Magic Absorption
7008 if (dummySpell->SpellIconID == 459) // only this spell has SpellIconID == 459 and dummy aura
7009 {
7011 return false;
7012
7013 // mana reward
7014 basepoints0 = CalculatePct(int32(GetMaxPower(POWER_MANA)), triggerAmount);
7015 target = this;
7016 triggered_spell_id = 29442;
7017 break;
7018 }
7019 // Hot Streak
7020 if (dummySpell->SpellIconID == 2999)
7021 {
7022 if (effIndex != 0)
7023 return false;
7024 AuraEffect* counter = triggeredByAura->GetBase()->GetEffect(EFFECT_1);
7025 if (!counter)
7026 return true;
7027
7028 // Count spell criticals in a row in second aura
7029 if (procEx & PROC_EX_CRITICAL_HIT)
7030 {
7031 counter->SetAmount(counter->GetAmount() * 2);
7032 if (counter->GetAmount() < 100) // not enough
7033 return true;
7034 // Crititcal counted -> roll chance
7035 if (roll_chance_i(triggerAmount))
7036 CastSpell(this, 48108, true, castItem, triggeredByAura);
7037 }
7038 counter->SetAmount(25);
7039 return true;
7040 }
7041 // Incanter's Regalia set (add trigger chance to Mana Shield)
7042 if (dummySpell->SpellFamilyFlags[0] & 0x8000)
7043 {
7044 if (GetTypeId() != TYPEID_PLAYER)
7045 return false;
7046
7047 target = this;
7048 triggered_spell_id = 37436;
7049 break;
7050 }
7051 switch (dummySpell->Id)
7052 {
7053 // Glyph of Polymorph
7054 case 56375:
7055 {
7056 if (!target)
7057 return false;
7058 target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE, ObjectGuid::Empty, target->GetAura(32409)); // SW:D shall not be removed.
7061 return true;
7062 }
7063 // Glyph of Icy Veins
7064 case 56374:
7065 {
7068 return true;
7069 }
7070 // Glyph of Ice Block
7071 case 56372:
7072 {
7073 Player* player = ToPlayer();
7074 if (!player)
7075 return false;
7076
7077 SpellCooldowns const cooldowns = player->GetSpellCooldowns();
7078 // remove cooldowns on all ranks of Frost Nova
7079 for (SpellCooldowns::const_iterator itr = cooldowns.begin(); itr != cooldowns.end(); ++itr)
7080 {
7081 SpellInfo const* cdSpell = sSpellMgr->GetSpellInfo(itr->first);
7082 // Frost Nova
7083 if (cdSpell && cdSpell->SpellFamilyName == SPELLFAMILY_MAGE
7084 && cdSpell->SpellFamilyFlags[0] & 0x00000040)
7085 player->RemoveSpellCooldown(cdSpell->Id, true);
7086 }
7087 break;
7088 }
7089 }
7090 break;
7091 }
7093 {
7094 switch (dummySpell->Id)
7095 {
7096 // Victorious
7097 case 32216:
7098 {
7099 RemoveAura(dummySpell->Id);
7100 return false;
7101 }
7102 }
7103
7104 // Second Wind
7105 if (dummySpell->SpellIconID == 1697)
7106 {
7107 // only for spells and hit/crit (trigger start always) and not start from self casted spells (5530 Mace Stun Effect for example)
7108 if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
7109 return false;
7110 // Need stun or root mechanic
7111 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_STUN))))
7112 return false;
7113
7114 switch (dummySpell->Id)
7115 {
7116 case 29838:
7117 triggered_spell_id = 29842;
7118 break;
7119 case 29834:
7120 triggered_spell_id = 29841;
7121 break;
7122 case 42770:
7123 triggered_spell_id = 42771;
7124 break;
7125 default:
7126 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled spell id: {} (SW)", dummySpell->Id);
7127 return false;
7128 }
7129
7130 target = this;
7131 break;
7132 }
7133 break;
7134 }
7136 {
7137 switch (dummySpell->Id)
7138 {
7139 // Nightfall
7140 case 18094:
7141 case 18095:
7142 // Glyph of corruption
7143 case 56218:
7144 {
7145 target = this;
7146 triggered_spell_id = 17941;
7147 break;
7148 }
7149 // Soul Leech
7150 case 30293:
7151 case 30295:
7152 case 30296:
7153 {
7154 // Improved Soul Leech
7155 AuraEffectList const& SoulLeechAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
7156 for (Unit::AuraEffectList::const_iterator i = SoulLeechAuras.begin(); i != SoulLeechAuras.end(); ++i)
7157 {
7158 if ((*i)->GetId() == 54117 || (*i)->GetId() == 54118)
7159 {
7160 if ((*i)->GetEffIndex() != 0)
7161 continue;
7162 basepoints0 = int32((*i)->GetAmount());
7163 target = GetGuardianPet();
7164 if (target)
7165 {
7166 // regen mana for pet
7167 CastCustomSpell(target, 54607, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
7168 }
7169 // regen mana for caster
7170 CastCustomSpell(this, 59117, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
7171 // Get second aura of spell for replenishment effect on party
7172 if (AuraEffect const* aurEff = (*i)->GetBase()->GetEffect(EFFECT_1))
7173 {
7174 // Replenishment - roll chance
7175 if (roll_chance_i(aurEff->GetAmount()))
7176 {
7177 CastSpell(this, 57669, true, castItem, triggeredByAura);
7178 }
7179 }
7180 break;
7181 }
7182 }
7183 // health
7184 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7185 target = this;
7186 triggered_spell_id = 30294;
7187 break;
7188 }
7189 // Shadowflame (Voidheart Raiment set bonus)
7190 case 37377:
7191 {
7192 triggered_spell_id = 37379;
7193 break;
7194 }
7195 // Pet Healing (Corruptor Raiment or Rift Stalker Armor)
7196 case 37381:
7197 {
7198 target = GetGuardianPet();
7199 if (!target)
7200 return false;
7201
7202 // heal amount
7203 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7204 triggered_spell_id = 37382;
7205 break;
7206 }
7207 // Shadowflame Hellfire (Voidheart Raiment set bonus)
7208 case 39437:
7209 {
7210 triggered_spell_id = 37378;
7211 break;
7212 }
7213 }
7214 break;
7215 }
7216 case SPELLFAMILY_PRIEST:
7217 {
7218 // Body and Soul
7219 if (dummySpell->SpellIconID == 2218)
7220 {
7221 // Proc only from Abolish desease on self cast
7222 if (procSpell->Id != 552 || victim != this || !roll_chance_i(triggerAmount))
7223 return false;
7224 triggered_spell_id = 64136;
7225 target = this;
7226 break;
7227 }
7228 switch (dummySpell->Id)
7229 {
7230 // Vampiric Embrace
7231 case 15286:
7232 {
7233 if (!victim || !victim->IsAlive() || procSpell->SpellFamilyFlags[1] & 0x80000)
7234 return false;
7235
7236 // heal amount
7237 int32 total = CalculatePct(int32(damage), triggerAmount);
7238 int32 team = total / 5;
7239 int32 self = total - team;
7240 CastCustomSpell(this, 15290, &team, &self, nullptr, true, castItem, triggeredByAura);
7241 return true; // no hidden cooldown
7242 }
7243 // Priest Tier 6 Trinket (Ashtongue Talisman of Acumen)
7244 case 40438:
7245 {
7246 // Shadow Word: Pain
7247 if (procSpell->SpellFamilyFlags[0] & 0x8000)
7248 triggered_spell_id = 40441;
7249 // Renew
7250 else if (procSpell->SpellFamilyFlags[0] & 0x40)
7251 triggered_spell_id = 40440;
7252 else
7253 return false;
7254
7255 target = this;
7256 break;
7257 }
7258 // Improved Shadowform
7259 case 47570:
7260 case 47569:
7261 {
7262 if (!roll_chance_i(triggerAmount))
7263 return false;
7264
7266 break;
7267 }
7268 // Glyph of Dispel Magic
7269 case 55677:
7270 {
7271 // Dispel Magic shares spellfamilyflag with abolish disease
7272 if (procSpell->SpellIconID != 74)
7273 return false;
7274 if (!target || !target->IsFriendlyTo(this))
7275 return false;
7276
7277 basepoints0 = int32(target->CountPctFromMaxHealth(triggerAmount));
7278 triggered_spell_id = 56131;
7279 break;
7280 }
7281 // Oracle Healing Bonus ("Garments of the Oracle" set)
7282 case 26169:
7283 {
7284 // heal amount
7285 basepoints0 = int32(CalculatePct(damage, 10));
7286 target = this;
7287 triggered_spell_id = 26170;
7288 break;
7289 }
7290 // Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
7291 case 39372:
7292 {
7293 if (!procSpell || (procSpell->GetSchoolMask() & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW)) == 0)
7294 return false;
7295
7296 // heal amount
7297 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7298 target = this;
7299 triggered_spell_id = 39373;
7300 break;
7301 }
7302 // Greater Heal (Vestments of Faith (Priest Tier 3) - 4 pieces bonus)
7303 case 28809:
7304 {
7305 triggered_spell_id = 28810;
7306 break;
7307 }
7308 // Priest T10 Healer 2P Bonus
7309 case 70770:
7310 // Flash Heal
7311 if (procSpell->SpellFamilyFlags[0] & 0x800)
7312 {
7313 triggered_spell_id = 70772;
7314 SpellInfo const* blessHealing = sSpellMgr->GetSpellInfo(triggered_spell_id);
7315 if (!blessHealing || !victim)
7316 return false;
7317 basepoints0 = int32(CalculatePct(damage, triggerAmount) / (blessHealing->GetMaxDuration() / blessHealing->Effects[0].Amplitude));
7318 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0);
7319 return true;
7320 }
7321 break;
7322 }
7323 break;
7324 }
7325 case SPELLFAMILY_DRUID:
7326 {
7327 switch (dummySpell->Id)
7328 {
7329 // Glyph of Innervate
7330 case 54832:
7331 {
7332 if (procSpell->SpellIconID != 62)
7333 return false;
7334
7335 int32 mana_perc = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
7336 basepoints0 = int32(CalculatePct(GetCreatePowers(POWER_MANA), mana_perc) / 10);
7337 triggered_spell_id = 54833;
7338 target = this;
7339 break;
7340 }
7341 // Glyph of Starfire
7342 case 54845:
7343 {
7344 triggered_spell_id = 54846;
7345 break;
7346 }
7347 // Glyph of Shred
7348 case 54815:
7349 {
7350 if (!target)
7351 return false;
7352
7353 // try to find spell Rip on the target
7354 if (AuraEffect const* AurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00800000, 0x0, 0x0, GetGUID()))
7355 {
7356 // Rip's max duration, note: spells which modifies Rip's duration also counted like Glyph of Rip
7357 uint32 CountMin = AurEff->GetBase()->GetMaxDuration();
7358
7359 // just Rip's max duration without other spells
7360 uint32 CountMax = AurEff->GetSpellInfo()->GetMaxDuration();
7361
7362 // add possible auras' and Glyph of Shred's max duration
7363 CountMax += 3 * triggerAmount * IN_MILLISECONDS; // Glyph of Shred -> +6 seconds
7364 CountMax += HasAura(54818) ? 4 * IN_MILLISECONDS : 0; // Glyph of Rip -> +4 seconds
7365 CountMax += HasAura(60141) ? 4 * IN_MILLISECONDS : 0; // Rip Duration/Lacerate Damage -> +4 seconds
7366
7367 // if min < max -> that means caster didn't cast 3 shred yet
7368 // so set Rip's duration and max duration
7369 if (CountMin < CountMax)
7370 {
7371 AurEff->GetBase()->SetDuration(AurEff->GetBase()->GetDuration() + triggerAmount * IN_MILLISECONDS);
7372 AurEff->GetBase()->SetMaxDuration(CountMin + triggerAmount * IN_MILLISECONDS);
7373 return true;
7374 }
7375 }
7376 // if not found Rip
7377 return false;
7378 }
7379 // Glyph of Rake
7380 case 54821:
7381 {
7382 if (procSpell->SpellVisual[0] == 750 && procSpell->Effects[1].ApplyAuraName == 3)
7383 {
7384 if (target && target->GetTypeId() == TYPEID_UNIT)
7385 {
7386 triggered_spell_id = 54820;
7387 break;
7388 }
7389 }
7390 return false;
7391 }
7392 // Leader of the Pack
7393 case 24932:
7394 {
7395 if (triggerAmount <= 0)
7396 return false;
7397 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
7398 target = this;
7399 triggered_spell_id = 34299;
7400 if (triggeredByAura->GetCasterGUID() != GetGUID())
7401 break;
7402 int32 basepoints1 = CalculatePct(GetMaxPower(Powers(POWER_MANA)), triggerAmount * 2);
7403 // Improved Leader of the Pack
7404 // Check cooldown of heal spell cooldown
7405 if (IsPlayer() && !ToPlayer()->HasSpellCooldown(34299))
7406 CastCustomSpell(this, 68285, &basepoints1, 0, 0, true, 0, triggeredByAura);
7407 break;
7408 }
7409 // Healing Touch (Dreamwalker Raiment set)
7410 case 28719:
7411 {
7412 // mana back
7413 basepoints0 = int32(CalculatePct(spellProc->GetPowerCost(), 30));
7414 target = this;
7415 triggered_spell_id = 28742;
7416 break;
7417 }
7418 // Glyph of Rejuvenation
7419 case 54754:
7420 {
7421 if (!victim || !victim->HealthBelowPct(uint32(triggerAmount)))
7422 return false;
7423 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7424 triggered_spell_id = 54755;
7425 break;
7426 }
7427 // Healing Touch Refund (Idol of Longevity trinket)
7428 case 28847:
7429 {
7430 target = this;
7431 triggered_spell_id = 28848;
7432 break;
7433 }
7434 // Mana Restore (Malorne Raiment set / Malorne Regalia set)
7435 case 37288:
7436 case 37295:
7437 {
7438 target = this;
7439 triggered_spell_id = 37238;
7440 break;
7441 }
7442 // Druid Tier 6 Trinket
7443 case 40442:
7444 {
7445 float chance;
7446
7447 // Starfire
7448 if (procSpell->SpellFamilyFlags[0] & 0x4)
7449 {
7450 triggered_spell_id = 40445;
7451 chance = 25.0f;
7452 }
7453 // Rejuvenation
7454 else if (procSpell->SpellFamilyFlags[0] & 0x10)
7455 {
7456 triggered_spell_id = 40446;
7457 chance = 25.0f;
7458 }
7459 // Mangle (Bear) and Mangle (Cat)
7460 else if (procSpell->SpellFamilyFlags[1] & 0x00000440)
7461 {
7462 triggered_spell_id = 40452;
7463 chance = 40.0f;
7464 }
7465 else
7466 return false;
7467
7468 if (!roll_chance_f(chance))
7469 return false;
7470
7471 target = this;
7472 break;
7473 }
7474 // Maim Interrupt
7475 case 44835:
7476 {
7477 // Deadly Interrupt Effect
7478 triggered_spell_id = 32747;
7479 break;
7480 }
7481 // Item - Druid T10 Restoration 4P Bonus (Rejuvenation)
7482 case 70664:
7483 {
7484 // xinef: proc only from normal Rejuvenation, and proc rejuvenation
7485 if (!victim || !procSpell || procSpell->SpellIconID != 64)
7486 return false;
7487
7488 Player* caster = ToPlayer();
7489 if (!caster)
7490 return false;
7491 if (!caster->GetGroup() && victim == this)
7492 return false;
7493
7494 CastCustomSpell(70691, SPELLVALUE_BASE_POINT0, damage, victim, true);
7495 return true;
7496 }
7497 }
7498 // Eclipse
7499 if (dummySpell->SpellIconID == 2856 && IsPlayer())
7500 {
7501 if (!procSpell || effIndex != 0)
7502 return false;
7503
7504 bool isWrathSpell = (procSpell->SpellFamilyFlags[0] & 1);
7505
7506 if (!roll_chance_f(dummySpell->ProcChance * (isWrathSpell ? 0.6f : 1.0f)))
7507 return false;
7508
7509 target = this;
7510 if (target->HasAura(isWrathSpell ? 48517 : 48518))
7511 return false;
7512
7513 triggered_spell_id = isWrathSpell ? 48518 : 48517;
7514 break;
7515 }
7516 [[fallthrough]];
7517 }
7518 case SPELLFAMILY_ROGUE:
7519 {
7520 switch(dummySpell->Id)
7521 {
7522 // Glyph of Backstab
7523 case 56800:
7524 {
7525 if (victim)
7526 if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID()))
7527 if (Aura* aur = aurEff->GetBase())
7528 if (!aur->IsRemoved() && aur->GetDuration() > 0)
7529 if ((aur->GetApplyTime() + aur->GetMaxDuration() / 1000 + 5) > (GameTime::GetGameTime().count() + aur->GetDuration() / 1000) )
7530 {
7531 aur->SetDuration(aur->GetDuration() + 2000);
7532 return true;
7533 }
7534 return false;
7535 }
7536 // Deadly Throw Interrupt
7537 case 32748:
7538 {
7539 // Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw
7540 if (this == victim)
7541 return false;
7542
7543 triggered_spell_id = 32747;
7544 break;
7545 }
7546 }
7547 // Master of subtlety
7548 if( dummySpell->SpellIconID == 2114 )
7549 {
7550 triggered_spell_id = 31665;
7551 basepoints0 = triggerAmount;
7552 break;
7553 }
7554 // Cut to the Chase
7555 if (dummySpell->SpellIconID == 2909)
7556 {
7557 // "refresh your Slice and Dice duration to its 5 combo point maximum"
7558 // lookup Slice and Dice
7559 if (AuraEffect const* aur = GetAuraEffect(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_ROGUE, 0x40000, 0, 0))
7560 {
7561 aur->GetBase()->SetDuration(aur->GetSpellInfo()->GetMaxDuration(), true);
7562 return true;
7563 }
7564 return false;
7565 }
7566 // Deadly Brew
7567 else if (dummySpell->SpellIconID == 2963)
7568 {
7569 triggered_spell_id = 3409;
7570 break;
7571 }
7572 // Quick Recovery
7573 else if (dummySpell->SpellIconID == 2116)
7574 {
7575 if (!procSpell)
7576 return false;
7577
7578 // energy cost save
7579 basepoints0 = CalculatePct(int32(procSpell->ManaCost), triggerAmount);
7580 if (basepoints0 <= 0)
7581 return false;
7582
7583 target = this;
7584 triggered_spell_id = 31663;
7585 break;
7586 }
7587 break;
7588 }
7589 case SPELLFAMILY_HUNTER:
7590 {
7591 switch (dummySpell->SpellIconID)
7592 {
7593 case 2236: // Thrill of the Hunt
7594 {
7595 if (!procSpell)
7596 return false;
7597
7599
7600 // Disable charge drop because of Lock and Load
7601 if (spell)
7602 ToPlayer()->SetSpellModTakingSpell(spell, false);
7603
7604 // Explosive Shot
7605 if (procSpell->SpellFamilyFlags[2] & 0x200)
7606 {
7607 if (!victim)
7608 return false;
7609 if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
7610 basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4 / 10 / 3;
7611 }
7612 else
7613 basepoints0 = procSpell->CalcPowerCost(this, SpellSchoolMask(procSpell->SchoolMask)) * 4 / 10;
7614
7615 if (spell)
7616 ToPlayer()->SetSpellModTakingSpell(spell, true);
7617
7618 if (basepoints0 <= 0)
7619 return false;
7620
7621 target = this;
7622 triggered_spell_id = 34720;
7623 break;
7624 }
7625 case 3406: // Hunting Party
7626 {
7627 triggered_spell_id = 57669;
7628 target = this;
7629 break;
7630 }
7631 case 3560: // Rapid Recuperation
7632 {
7633 // This effect only from Rapid Killing (mana regen)
7634 if (!(procSpell->SpellFamilyFlags[1] & 0x01000000))
7635 return false;
7636
7637 target = this;
7638
7639 switch (dummySpell->Id)
7640 {
7641 case 53228: // Rank 1
7642 triggered_spell_id = 56654;
7643 break;
7644 case 53232: // Rank 2
7645 triggered_spell_id = 58882;
7646 break;
7647 }
7648 break;
7649 }
7650 }
7651
7652 switch (dummySpell->Id)
7653 {
7654 case 57870: // Glyph of Mend Pet
7655 {
7656 if (!victim)
7657 return false;
7658
7659 victim->CastSpell(victim, 57894, true, nullptr, nullptr, GetGUID());
7660 return true;
7661 }
7662 }
7663 break;
7664 }
7666 {
7667 // Light's Beacon - Beacon of Light
7668 if (dummySpell->Id == 53651)
7669 {
7670 if (!victim)
7671 return false;
7672
7673 // Do not proc from Glyph of Holy Light and Judgement of Light
7674 if (procSpell->Id == 20267 || procSpell->Id == 54968)
7675 {
7676 return false;
7677 }
7678
7679 Unit* beaconTarget = triggeredByAura->GetBase()->GetCaster();
7680 if (!beaconTarget || beaconTarget == this || !beaconTarget->GetAura(53563, victim->GetGUID()))
7681 return false;
7682
7683 basepoints0 = int32(damage);
7684 triggered_spell_id = procSpell->IsRankOf(sSpellMgr->GetSpellInfo(635)) ? 53652 : 53654;
7685
7686 victim->CastCustomSpell(beaconTarget, triggered_spell_id, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura, victim->GetGUID());
7687 return true;
7688 }
7689 // Judgements of the Wise
7690 if (dummySpell->SpellIconID == 3017)
7691 {
7692 target = this;
7693 triggered_spell_id = 31930;
7694 // replenishment
7695 CastSpell(this, 57669, true, castItem, triggeredByAura);
7696 break;
7697 }
7698 // Righteous Vengeance
7699 if (dummySpell->SpellIconID == 3025)
7700 {
7701 if (!victim)
7702 return false;
7703
7704 // 4 damage tick
7705 basepoints0 = triggerAmount * damage / 400;
7706 triggered_spell_id = 61840;
7707 // Add remaining ticks to damage done
7708 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
7709 return true;
7710 }
7711 // Sheath of Light
7712 if (dummySpell->SpellIconID == 3030)
7713 {
7714 // 4 healing tick
7715 basepoints0 = triggerAmount * damage / 400;
7716 triggered_spell_id = 54203;
7717 break;
7718 }
7719 switch (dummySpell->Id)
7720 {
7721 // Judgement of Light
7722 case 20185:
7723 {
7724 if (!victim || !victim->IsAlive() || victim->HasSpellCooldown(20267))
7725 return false;
7726 // 2% of base mana
7727 basepoints0 = int32(victim->CountPctFromMaxHealth(2));
7728 victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura);
7729 victim->AddSpellCooldown(20267, 0, 4 * IN_MILLISECONDS);
7730 return true;
7731 }
7732 // Judgement of Wisdom
7733 case 20186:
7734 {
7735 if (!victim || !victim->IsAlive() || !victim->HasActivePowerType(POWER_MANA) || victim->HasSpellCooldown(20268))
7736 return false;
7737
7738 // 2% of base mana
7739 basepoints0 = int32(CalculatePct(victim->GetCreateMana(), 2));
7740 victim->CastCustomSpell(victim, 20268, &basepoints0, nullptr, nullptr, true, 0, triggeredByAura);
7741 victim->AddSpellCooldown(20268, 0, 4 * IN_MILLISECONDS);
7742 return true;
7743 }
7744 // Holy Power (Redemption Armor set)
7745 case 28789:
7746 {
7747 if (!victim)
7748 return false;
7749
7750 // Set class defined buff
7751 switch (victim->getClass())
7752 {
7753 case CLASS_PALADIN:
7754 case CLASS_PRIEST:
7755 case CLASS_SHAMAN:
7756 case CLASS_DRUID:
7757 triggered_spell_id = 28795; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
7758 break;
7759 case CLASS_MAGE:
7760 case CLASS_WARLOCK:
7761 triggered_spell_id = 28793; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
7762 break;
7763 case CLASS_HUNTER:
7764 case CLASS_ROGUE:
7765 triggered_spell_id = 28791; // Increases the friendly target's attack power by $s1 for $d.
7766 break;
7767 case CLASS_WARRIOR:
7768 triggered_spell_id = 28790; // Increases the friendly target's armor
7769 break;
7770 default:
7771 return false;
7772 }
7773 break;
7774 }
7775 // Seal of Vengeance (damage calc on apply aura)
7776 case 31801:
7777 {
7778 if (effIndex != 0 || !victim) // effect 1, 2 used by seal unleashing code
7779 return false;
7780
7781 // At melee attack or Hammer of the Righteous spell damage considered as melee attack
7782 bool stacker = !procSpell || procSpell->Id == 53595;
7783 // spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
7784 bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
7785
7786 if (!stacker && !damager)
7787 return false;
7788
7789 triggered_spell_id = 31803;
7790
7791 if (Aura* aur = victim->GetAura(triggered_spell_id, GetGUID()))
7792 {
7793 if (aur->GetStackAmount() == 5)
7794 {
7795 if (stacker)
7796 aur->RefreshDuration();
7797 }
7798 }
7799
7800 CastSpell(victim, 42463, true, castItem, triggeredByAura); // Seal of Vengeance
7801
7802 if (!stacker)
7803 return false;
7804 break;
7805 }
7806 // Seal of Corruption
7807 case 53736:
7808 {
7809 if (effIndex != 0 || !victim) // effect 1, 2 used by seal unleashing code
7810 return false;
7811
7812 // At melee attack or Hammer of the Righteous spell damage considered as melee attack
7813 bool stacker = !procSpell || procSpell->Id == 53595;
7814 // spells with SPELL_DAMAGE_CLASS_MELEE excluding Judgements
7815 bool damager = procSpell && (procSpell->EquippedItemClass != -1 || (procSpell->SpellIconID == 243 && procSpell->SpellVisual[0] == 39));
7816
7817 if (!stacker && !damager)
7818 return false;
7819
7820 triggered_spell_id = 53742;
7821
7822 if (Aura* aur = victim->GetAura(triggered_spell_id, GetGUID()))
7823 {
7824 if (aur->GetStackAmount() == 5)
7825 {
7826 if (stacker)
7827 aur->RefreshDuration();
7828 }
7829 }
7830
7831 CastSpell(victim, 53739, true, castItem, triggeredByAura); // Seal of Corruption
7832
7833 if (!stacker)
7834 return false;
7835 break;
7836 }
7837 // Spiritual Attunement
7838 case 31785:
7839 case 33776:
7840 {
7841 // if healed by another unit (victim)
7842 if (this == victim)
7843 return false;
7844
7845 // dont allow non-positive dots to proc
7846 if (!procSpell || !procSpell->IsPositive())
7847 return false;
7848
7849 HealInfo const* healInfo = eventInfo.GetHealInfo();
7850 if (!healInfo)
7851 {
7852 return false;
7853 }
7854
7855 uint32 effectiveHeal = healInfo->GetEffectiveHeal();
7856 if (effectiveHeal)
7857 {
7858 // heal amount
7859 basepoints0 = int32(CalculatePct(effectiveHeal, triggerAmount));
7860 target = this;
7861
7862 if (basepoints0)
7863 triggered_spell_id = 31786;
7864 }
7865 break;
7866 }
7867 // Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
7868 case 40470:
7869 {
7870 if (!procSpell)
7871 return false;
7872
7873 float chance = 0.0f;
7874
7875 // Flash of light/Holy light
7876 if (procSpell->SpellFamilyFlags[0] & 0xC0000000)
7877 {
7878 triggered_spell_id = 40471;
7879 chance = 15.0f;
7880 }
7881 // Judgement (any)
7882 else if (procSpell->SpellFamilyFlags[0] & 0x800000)
7883 {
7884 triggered_spell_id = 40472;
7885 chance = 50.0f;
7886 }
7887 else
7888 return false;
7889
7890 if (!roll_chance_f(chance))
7891 return false;
7892
7893 break;
7894 }
7895 // Glyph of Holy Light
7896 case 54937:
7897 {
7898 triggered_spell_id = 54968;
7899 basepoints0 = CalculatePct(int32(damage), triggerAmount);
7900 break;
7901 }
7902 // Item - Paladin T8 Holy 2P Bonus
7903 case 64890:
7904 {
7905 triggered_spell_id = 64891;
7906 basepoints0 = triggerAmount * damage / 300;
7907 break;
7908 }
7909 case 71406: // Tiny Abomination in a Jar
7910 case 71545: // Tiny Abomination in a Jar (Heroic)
7911 {
7912 if (!victim || !victim->IsAlive())
7913 return false;
7914
7915 CastSpell(this, 71432, true, nullptr, triggeredByAura);
7916
7917 Aura const* dummy = GetAura(71432);
7918 if (!dummy || dummy->GetStackAmount() < (dummySpell->Id == 71406 ? 8 : 7))
7919 return false;
7920
7921 RemoveAurasDueToSpell(71432);
7922 triggered_spell_id = 71433; // default main hand attack
7923 // roll if offhand
7924 if (Player const* player = ToPlayer())
7925 if (player->GetWeaponForAttack(OFF_ATTACK, true) && urand(0, 1))
7926 triggered_spell_id = 71434;
7927 target = victim;
7928 break;
7929 }
7930 // Item - Icecrown 25 Normal Dagger Proc
7931 case 71880:
7932 {
7933 switch (getPowerType())
7934 {
7935 case POWER_MANA:
7936 triggered_spell_id = 71881;
7937 break;
7938 case POWER_RAGE:
7939 triggered_spell_id = 71883;
7940 break;
7941 case POWER_ENERGY:
7942 triggered_spell_id = 71882;
7943 break;
7944 case POWER_RUNIC_POWER:
7945 triggered_spell_id = 71884;
7946 break;
7947 default:
7948 return false;
7949 }
7950 break;
7951 }
7952 // Item - Icecrown 25 Heroic Dagger Proc
7953 case 71892:
7954 {
7955 switch (getPowerType())
7956 {
7957 case POWER_MANA:
7958 triggered_spell_id = 71888;
7959 break;
7960 case POWER_RAGE:
7961 triggered_spell_id = 71886;
7962 break;
7963 case POWER_ENERGY:
7964 triggered_spell_id = 71887;
7965 break;
7966 case POWER_RUNIC_POWER:
7967 triggered_spell_id = 71885;
7968 break;
7969 default:
7970 return false;
7971 }
7972 break;
7973 }
7974 }
7975 break;
7976 }
7977 case SPELLFAMILY_SHAMAN:
7978 {
7979 switch (dummySpell->Id)
7980 {
7981 // Tidal Force
7982 case 55198:
7983 {
7984 // Remove aura stack from caster
7985 RemoveAuraFromStack(55166);
7986 // drop charges
7987 return false;
7988 }
7989 // Totemic Power (The Earthshatterer set)
7990 case 28823:
7991 {
7992 if (!victim)
7993 return false;
7994
7995 // Set class defined buff
7996 switch (victim->getClass())
7997 {
7998 case CLASS_PALADIN:
7999 case CLASS_PRIEST:
8000 case CLASS_SHAMAN:
8001 case CLASS_DRUID:
8002 triggered_spell_id = 28824; // Increases the friendly target's mana regeneration by $s1 per 5 sec. for $d.
8003 break;
8004 case CLASS_MAGE:
8005 case CLASS_WARLOCK:
8006 triggered_spell_id = 28825; // Increases the friendly target's spell damage and healing by up to $s1 for $d.
8007 break;
8008 case CLASS_HUNTER:
8009 case CLASS_ROGUE:
8010 triggered_spell_id = 28826; // Increases the friendly target's attack power by $s1 for $d.
8011 break;
8012 case CLASS_WARRIOR:
8013 triggered_spell_id = 28827; // Increases the friendly target's armor
8014 break;
8015 default:
8016 return false;
8017 }
8018 break;
8019 }
8020 // Lesser Healing Wave (Totem of Flowing Water Relic)
8021 case 28849:
8022 {
8023 target = this;
8024 triggered_spell_id = 28850;
8025 break;
8026 }
8027 // Windfury Weapon (Passive) 1-8 Ranks
8028 case 33757:
8029 {
8030 Player* player = ToPlayer();
8031 if (!player || !castItem || !castItem->IsEquipped() || !victim || !victim->IsAlive())
8032 return false;
8033
8034 if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID())
8035 return false;
8036
8037 WeaponAttackType attType = WeaponAttackType(player->GetAttackBySlot(castItem->GetSlot()));
8038 if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
8039 || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8040 || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
8041 return false;
8042
8043 // Now amount of extra power stored in 1 effect of Enchant spell
8044 // Get it by item enchant id
8045 uint32 spellId;
8047 {
8048 case 283:
8049 spellId = 8232;
8050 break; // 1 Rank
8051 case 284:
8052 spellId = 8235;
8053 break; // 2 Rank
8054 case 525:
8055 spellId = 10486;
8056 break; // 3 Rank
8057 case 1669:
8058 spellId = 16362;
8059 break; // 4 Rank
8060 case 2636:
8061 spellId = 25505;
8062 break; // 5 Rank
8063 case 3785:
8064 spellId = 58801;
8065 break; // 6 Rank
8066 case 3786:
8067 spellId = 58803;
8068 break; // 7 Rank
8069 case 3787:
8070 spellId = 58804;
8071 break; // 8 Rank
8072 default:
8073 {
8074 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) {} for spell id: {} (Windfury)",
8075 castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id);
8076 return false;
8077 }
8078 }
8079
8080 SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId);
8081 if (!windfurySpellInfo)
8082 {
8083 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: non-existing spell id: {} (Windfury)", spellId);
8084 return false;
8085 }
8086
8087 int32 extra_attack_power = CalculateSpellDamage(victim, windfurySpellInfo, 1);
8088
8089 // Value gained from additional AP
8090 basepoints0 = int32(extra_attack_power / 14.0f * GetAttackTime(attType) / 1000);
8091
8092 if (procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
8093 triggered_spell_id = 25504;
8094
8095 if (procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8096 triggered_spell_id = 33750;
8097
8098 // custom cooldown processing case
8099 if (player->HasSpellCooldown(dummySpell->Id))
8100 return false;
8101
8102 // apply cooldown before cast to prevent processing itself
8103 player->AddSpellCooldown(dummySpell->Id, 0, 3 * IN_MILLISECONDS);
8104
8105 // Attack Twice
8106 for (uint32 i = 0; i < 2; ++i)
8107 CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
8108
8109 return true;
8110 }
8111 // Shaman Tier 6 Trinket
8112 case 40463:
8113 {
8114 if (!procSpell)
8115 return false;
8116
8117 float chance;
8118 if (procSpell->SpellFamilyFlags[0] & 0x1)
8119 {
8120 triggered_spell_id = 40465; // Lightning Bolt
8121 chance = 15.0f;
8122 }
8123 else if (procSpell->SpellFamilyFlags[0] & 0x80)
8124 {
8125 triggered_spell_id = 40465; // Lesser Healing Wave
8126 chance = 10.0f;
8127 }
8128 else if (procSpell->SpellFamilyFlags[1] & 0x00000010)
8129 {
8130 triggered_spell_id = 40466; // Stormstrike
8131 chance = 50.0f;
8132 }
8133 else
8134 return false;
8135
8136 if (!roll_chance_f(chance))
8137 return false;
8138
8139 target = this;
8140 break;
8141 }
8142 // Glyph of Healing Wave
8143 case 55440:
8144 {
8145 // Not proc from self heals
8146 if (this == victim)
8147 return false;
8148 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8149 target = this;
8150 triggered_spell_id = 55533;
8151 break;
8152 }
8153 // Spirit Hunt
8154 case 58877:
8155 {
8156 // Cast on owner
8157 target = GetOwner();
8158 if (!target)
8159 return false;
8160 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8161 triggered_spell_id = 58879;
8162 // Heal wolf
8163 CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8164 break;
8165 }
8166 // Shaman T9 Elemental 4P Bonus
8167 case 67228:
8168 {
8169 // Lava Burst
8170 if (procSpell->SpellFamilyFlags[1] & 0x1000)
8171 {
8172 triggered_spell_id = 71824;
8173 SpellInfo const* triggeredSpell = sSpellMgr->GetSpellInfo(triggered_spell_id);
8174 if (!triggeredSpell)
8175 return false;
8176 basepoints0 = CalculatePct(int32(damage), triggerAmount) / (triggeredSpell->GetMaxDuration() / triggeredSpell->Effects[0].Amplitude);
8177 }
8178 break;
8179 }
8180 // Item - Shaman T10 Elemental 4P Bonus
8181 case 70817:
8182 {
8183 if (!target)
8184 return false;
8185 // try to find spell Flame Shock on the target
8186 if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x0, 0x0, GetGUID()))
8187 {
8188 Aura* flameShock = aurEff->GetBase();
8189 int32 extraTime = 2 * aurEff->GetAmplitude();
8190 flameShock->SetMaxDuration(flameShock->GetMaxDuration() + extraTime);
8191 flameShock->SetDuration(flameShock->GetDuration() + extraTime);
8192
8193 return true;
8194 }
8195 // if not found Flame Shock
8196 return false;
8197 }
8198 break;
8199 }
8200 // Frozen Power
8201 if (dummySpell->SpellIconID == 3780)
8202 {
8203 if (!target)
8204 return false;
8205 if (GetDistance(target) < 15.0f)
8206 return false;
8207 float chance = (float)triggerAmount;
8208 if (!roll_chance_f(chance))
8209 return false;
8210
8211 triggered_spell_id = 63685;
8212 break;
8213 }
8214 // Ancestral Awakening
8215 if (dummySpell->SpellIconID == 3065)
8216 {
8217 triggered_spell_id = 52759;
8218 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8219 target = this;
8220 break;
8221 }
8222 // Flametongue Weapon (Passive)
8223 if (dummySpell->SpellFamilyFlags[0] & 0x200000)
8224 {
8225 if (GetTypeId() != TYPEID_PLAYER || !victim || !victim->IsAlive() || !castItem || !castItem->IsEquipped())
8226 return false;
8227
8229 if ((attType != BASE_ATTACK && attType != OFF_ATTACK)
8230 || (attType == BASE_ATTACK && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8231 || (attType == OFF_ATTACK && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK))
8232 return false;
8233
8234 float fire_onhit = float(CalculatePct(dummySpell->Effects[EFFECT_0]. CalcValue(), 1.0f));
8235
8236 float add_spellpower = (float)(SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_FIRE)
8238
8239 // 1.3speed = 5%, 2.6speed = 10%, 4.0 speed = 15%, so, 1.0speed = 3.84%
8240 ApplyPct(add_spellpower, 3.84f);
8241
8242 // Enchant on Off-Hand and ready?
8243 if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && procFlag & PROC_FLAG_DONE_OFFHAND_ATTACK)
8244 {
8245 float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK) / 1000.0f;
8246
8247 // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
8248 basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
8249 triggered_spell_id = 10444;
8250 }
8251
8252 // Enchant on Main-Hand and ready?
8253 else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && procFlag & PROC_FLAG_DONE_MAINHAND_ATTACK)
8254 {
8255 float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK) / 1000.0f;
8256
8257 // Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
8258 basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
8259 triggered_spell_id = 10444;
8260 }
8261
8262 // If not ready, we should return, shouldn't we?!
8263 else
8264 return false;
8265
8266 CastCustomSpell(victim, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
8267 return true;
8268 }
8269 // Improved Water Shield
8270 if (dummySpell->SpellIconID == 2287)
8271 {
8272 if (!procSpell)
8273 return false;
8274
8275 // Default chance for Healing Wave and Riptide
8276 float chance = (float)triggeredByAura->GetAmount();
8277
8278 if (procSpell->SpellFamilyFlags[0] & 0x80)
8279 // Lesser Healing Wave - 0.6 of default
8280 chance *= 0.6f;
8281 else if (procSpell->SpellFamilyFlags[0] & 0x100)
8282 // Chain heal - 0.3 of default
8283 chance *= 0.3f;
8284
8285 if (!roll_chance_f(chance))
8286 return false;
8287
8288 // Water Shield
8289 if (AuraEffect const* aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0, 0x00000020, 0))
8290 {
8291 uint32 spell = aurEff->GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
8292 CastSpell(this, spell, true, castItem, triggeredByAura);
8293 return true;
8294 }
8295 return false;
8296 }
8297 // Lightning Overload
8298 if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
8299 {
8300 if(!procSpell || GetTypeId() != TYPEID_PLAYER || !victim)
8301 return false;
8302
8303 if (procEx & PROC_EX_CRITICAL_HIT)
8304 damage /= 2;
8305
8306 // do not proc off from itself
8307 if (procSpell->Id == 45297 || procSpell->Id == 45284)
8308 {
8309 return false;
8310 }
8311
8312 do
8313 {
8314 uint32 spell = 0;
8315
8316 if (procSpell->SpellFamilyFlags[0] & 0x2)
8317 {
8318 // 1/3 of 33% if 11%
8319 if (!roll_chance_i(33))
8320 return false;
8321
8322 spell = 45297;
8323 }
8324 else
8325 spell = 45284;
8326
8327 // do not reduce damage-spells have correct basepoints
8328 damage /= 2;
8329 int32 dmg = damage;
8330
8331 // Cast
8332 CastCustomSpell(victim, spell, &dmg, 0, 0, true, castItem, triggeredByAura);
8333 } while (roll_chance_i(33));
8334 return true;
8335 }
8336 // Static Shock
8337 if (dummySpell->SpellIconID == 3059)
8338 {
8339 // Lightning Shield
8341 {
8342 uint32 spell = sSpellMgr->GetSpellWithRank(26364, aurEff->GetSpellInfo()->GetRank());
8343 CastSpell(target, spell, true, castItem, triggeredByAura);
8344 aurEff->GetBase()->DropCharge();
8345 return true;
8346 }
8347 return false;
8348 }
8349 break;
8350 }
8352 {
8353 // Improved Blood Presence
8354 if (dummySpell->SpellIconID == 2636)
8355 {
8356 if (GetTypeId() != TYPEID_PLAYER)
8357 return false;
8358 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8359 break;
8360 }
8361 // Butchery
8362 if (dummySpell->SpellIconID == 2664)
8363 {
8364 basepoints0 = triggerAmount;
8365 triggered_spell_id = 50163;
8366 target = this;
8367 break;
8368 }
8369 // Mark of Blood
8370 if (dummySpell->Id == 49005)
8371 {
8373 triggered_spell_id = 61607;
8374 break;
8375 }
8376 // Unholy Blight
8377 if (dummySpell->Id == 49194)
8378 {
8379 triggered_spell_id = 50536;
8380 SpellInfo const* unholyBlight = sSpellMgr->GetSpellInfo(triggered_spell_id);
8381 if (!unholyBlight || !victim)
8382 return false;
8383
8384 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8385
8386 //Glyph of Unholy Blight
8387 if (AuraEffect* glyph = GetAuraEffect(63332, 0))
8388 AddPct(basepoints0, glyph->GetAmount());
8389
8390 basepoints0 = basepoints0 / (unholyBlight->GetMaxDuration() / unholyBlight->Effects[0].Amplitude);
8391 victim->CastDelayedSpellWithPeriodicAmount(this, triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
8392 return true;
8393 }
8394 // Vendetta
8395 if (dummySpell->SpellFamilyFlags[0] & 0x10000)
8396 {
8397 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
8398 triggered_spell_id = 50181;
8399 target = this;
8400 break;
8401 }
8402 // Necrosis
8403 if (dummySpell->SpellIconID == 2709)
8404 {
8405 basepoints0 = CalculatePct(int32(damage), triggerAmount);
8406 triggered_spell_id = 51460;
8407 break;
8408 }
8409 // Threat of Thassarian
8410 if (dummySpell->SpellIconID == 2023)
8411 {
8412 // Must Dual Wield
8413 if (!procSpell || !haveOffhandWeapon())
8414 return false;
8415 // Chance as basepoints for dummy aura
8416 if (!roll_chance_i(triggerAmount))
8417 return false;
8418
8419 switch (procSpell->Id)
8420 {
8421 // Obliterate
8422 case 49020:
8423 triggered_spell_id = 66198;
8424 break; // Rank 1
8425 case 51423:
8426 triggered_spell_id = 66972;
8427 break; // Rank 2
8428 case 51424:
8429 triggered_spell_id = 66973;
8430 break; // Rank 3
8431 case 51425:
8432 triggered_spell_id = 66974;
8433 break; // Rank 4
8434
8435 // Frost Strike
8436 case 49143:
8437 triggered_spell_id = 66196;
8438 break; // Rank 1
8439 case 51416:
8440 triggered_spell_id = 66958;
8441 break; // Rank 2
8442 case 51417:
8443 triggered_spell_id = 66959;
8444 break; // Rank 3
8445 case 51418:
8446 triggered_spell_id = 66960;
8447 break; // Rank 4
8448 case 51419:
8449 triggered_spell_id = 66961;
8450 break; // Rank 5
8451 case 55268:
8452 triggered_spell_id = 66962;
8453 break; // Rank 6
8454
8455 // Plague Strike
8456 case 45462:
8457 triggered_spell_id = 66216;
8458 break; // Rank 1
8459 case 49917:
8460 triggered_spell_id = 66988;
8461 break; // Rank 2
8462 case 49918:
8463 triggered_spell_id = 66989;
8464 break; // Rank 3
8465 case 49919:
8466 triggered_spell_id = 66990;
8467 break; // Rank 4
8468 case 49920:
8469 triggered_spell_id = 66991;
8470 break; // Rank 5
8471 case 49921:
8472 triggered_spell_id = 66992;
8473 break; // Rank 6
8474
8475 // Death Strike
8476 case 49998:
8477 triggered_spell_id = 66188;
8478 break; // Rank 1
8479 case 49999:
8480 triggered_spell_id = 66950;
8481 break; // Rank 2
8482 case 45463:
8483 triggered_spell_id = 66951;
8484 break; // Rank 3
8485 case 49923:
8486 triggered_spell_id = 66952;
8487 break; // Rank 4
8488 case 49924:
8489 triggered_spell_id = 66953;
8490 break; // Rank 5
8491
8492 // Rune Strike
8493 case 56815:
8494 triggered_spell_id = 66217;
8495 break; // Rank 1
8496
8497 // Blood Strike
8498 case 45902:
8499 triggered_spell_id = 66215;
8500 break; // Rank 1
8501 case 49926:
8502 triggered_spell_id = 66975;
8503 break; // Rank 2
8504 case 49927:
8505 triggered_spell_id = 66976;
8506 break; // Rank 3
8507 case 49928:
8508 triggered_spell_id = 66977;
8509 break; // Rank 4
8510 case 49929:
8511 triggered_spell_id = 66978;
8512 break; // Rank 5
8513 case 49930:
8514 triggered_spell_id = 66979;
8515 break; // Rank 6
8516 default:
8517 return false;
8518 }
8519
8520 // This should do, restore spell mod so next attack can also use this!
8521 // crit chance for first strike is already computed
8522 ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 51124, nullptr); // Killing Machine
8523 ToPlayer()->RestoreSpellMods(m_currentSpells[CURRENT_GENERIC_SPELL], 49796, nullptr); // Deathchill
8524
8525 // Xinef: Somehow basepoints are divided by 2 which is later divided by 2 (offhand multiplier)
8526 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
8527 if (triggerEntry->SchoolMask & SPELL_SCHOOL_MASK_NORMAL)
8528 basepoints0 = triggerEntry->Effects[EFFECT_0].BasePoints * 2;
8529
8530 SetCantProc(true);
8531 if(basepoints0)
8532 CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8533 else
8534 CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
8535 SetCantProc(false);
8536 return true;
8537 }
8538 // Runic Power Back on Snare/Root
8539 if (dummySpell->Id == 61257)
8540 {
8541 // only for spells and hit/crit (trigger start always) and not start from self casted spells
8542 if (procSpell == 0 || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
8543 return false;
8544 // Need snare or root mechanic
8545 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_ROOT) | (1 << MECHANIC_SNARE))))
8546 return false;
8547 triggered_spell_id = 61258;
8548 target = this;
8549 break;
8550 }
8551 // Sudden Doom
8552 if (dummySpell->SpellIconID == 1939 && IsPlayer())
8553 {
8554 SpellChainNode const* chain = nullptr;
8555 // get highest rank of the Death Coil spell
8556 PlayerSpellMap const& sp_list = ToPlayer()->GetSpellMap();
8557 for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
8558 {
8559 // check if shown in spell book
8560 if (!itr->second->Active || !itr->second->IsInSpec(ToPlayer()->GetActiveSpec()) || itr->second->State == PLAYERSPELL_REMOVED)
8561 continue;
8562
8563 SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(itr->first);
8564 if (!spellProto)
8565 continue;
8566
8567 if (spellProto->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT
8568 && spellProto->SpellFamilyFlags[0] & 0x2000)
8569 {
8570 SpellChainNode const* newChain = sSpellMgr->GetSpellChainNode(itr->first);
8571
8572 // No chain entry or entry lower than found entry
8573 if (!chain || !newChain || (chain->rank < newChain->rank))
8574 {
8575 triggered_spell_id = itr->first;
8576 chain = newChain;
8577 }
8578 else
8579 continue;
8580 // Found spell is last in chain - do not need to look more
8581 // Optimisation for most common case
8582 if (chain && chain->last->Id == itr->first)
8583 break;
8584 }
8585 }
8586 }
8587 break;
8588 }
8589 case SPELLFAMILY_POTION:
8590 {
8591 // alchemist's stone
8592 if (dummySpell->Id == 17619)
8593 {
8594 if (procSpell->SpellFamilyName == SPELLFAMILY_POTION)
8595 {
8596 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
8597 {
8598 if (procSpell->Effects[i].Effect == SPELL_EFFECT_HEAL)
8599 {
8600 triggered_spell_id = 21399;
8601 }
8602 else if (procSpell->Effects[i].Effect == SPELL_EFFECT_ENERGIZE)
8603 {
8604 triggered_spell_id = 21400;
8605 }
8606 else
8607 continue;
8608
8609 basepoints0 = int32(CalculateSpellDamage(this, procSpell, i) * 0.4f);
8610 CastCustomSpell(this, triggered_spell_id, &basepoints0, nullptr, nullptr, true, nullptr, triggeredByAura);
8611 }
8612 return true;
8613 }
8614 }
8615 break;
8616 }
8617 case SPELLFAMILY_PET:
8618 {
8619 switch (dummySpell->SpellIconID)
8620 {
8621 // Guard Dog
8622 case 201:
8623 {
8624 if (!victim)
8625 return false;
8626
8627 triggered_spell_id = 54445;
8628 target = this;
8629 float addThreat = float(CalculatePct(procSpell->Effects[0].CalcValue(this), triggerAmount));
8630 victim->AddThreat(this, addThreat);
8631 break;
8632 }
8633 // Silverback
8634 case 1582:
8635 triggered_spell_id = dummySpell->Id == 62765 ? 62801 : 62800;
8636 target = this;
8637 break;
8638 }
8639 break;
8640 }
8641 default:
8642 break;
8643 }
8644
8645 // if not handled by custom case, get triggered spell from dummySpell proto
8646 if (!triggered_spell_id)
8647 triggered_spell_id = dummySpell->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
8648
8649 // processed charge only counting case
8650 if (!triggered_spell_id)
8651 return true;
8652
8653 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
8654 if (!triggerEntry)
8655 {
8656 LOG_ERROR("entities.unit", "Unit::HandleDummyAuraProc: Spell {} has non-existing triggered spell {}", dummySpell->Id, triggered_spell_id);
8657 return false;
8658 }
8659
8660 if (cooldown_spell_id == 0)
8661 cooldown_spell_id = triggered_spell_id;
8662
8663 if (cooldown)
8664 {
8665 if (HasSpellCooldown(cooldown_spell_id))
8666 return false;
8667
8668 AddSpellCooldown(cooldown_spell_id, 0, cooldown);
8669 }
8670
8671 if(basepoints0)
8672 CastCustomSpell(target, triggered_spell_id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura, originalCaster);
8673 else
8674 CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
8675
8676 return true;
8677}
@ PROC_EX_INTERNAL_HOT
Definition: SpellMgr.h:220
@ PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS
Definition: SpellMgr.h:128
@ PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS
Definition: SpellMgr.h:122
@ SPELL_AURA_PROC_TRIGGER_SPELL
Definition: SpellAuraDefines.h:105
@ SPELL_AURA_HASTE_SPELLS
Definition: SpellAuraDefines.h:279
@ SPELL_AURA_MOD_MELEE_HASTE
Definition: SpellAuraDefines.h:201
@ SPELL_AURA_MOD_DECREASE_SPEED
Definition: SpellAuraDefines.h:96
@ SPELL_AURA_PERIODIC_DUMMY
Definition: SpellAuraDefines.h:289
EnchantmentSlot
Definition: Item.h:168
@ TEMP_ENCHANTMENT_SLOT
Definition: Item.h:170
std::map< uint32, SpellCooldown > SpellCooldowns
Definition: Player.h:208
std::unordered_map< uint32, PlayerSpell * > PlayerSpellMap
Definition: Player.h:193
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:690
@ PLAYERSPELL_REMOVED
Definition: Player.h:122
WeaponAttackType
Definition: Unit.h:208
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition: CreatureAIImpl.h:30
@ SPELL_EFFECT_ENERGIZE
Definition: SharedDefines.h:808
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
@ CLASS_DRUID
Definition: SharedDefines.h:151
@ CLASS_SHAMAN
Definition: SharedDefines.h:147
@ CLASS_PRIEST
Definition: SharedDefines.h:145
@ CLASS_WARLOCK
Definition: SharedDefines.h:149
@ CLASS_MAGE
Definition: SharedDefines.h:148
@ CLASS_PALADIN
Definition: SharedDefines.h:142
@ CLASS_ROGUE
Definition: SharedDefines.h:144
@ MECHANIC_STUN
Definition: SharedDefines.h:1337
@ MECHANIC_ROOT
Definition: SharedDefines.h:1332
@ MECHANIC_SNARE
Definition: SharedDefines.h:1336
@ SPELLFAMILY_WARLOCK
Definition: SharedDefines.h:3533
@ SPELLFAMILY_PALADIN
Definition: SharedDefines.h:3538
@ SPELLFAMILY_HUNTER
Definition: SharedDefines.h:3537
@ SPELLFAMILY_POTION
Definition: SharedDefines.h:3541
@ SPELLFAMILY_ROGUE
Definition: SharedDefines.h:3536
@ SPELLFAMILY_DRUID
Definition: SharedDefines.h:3535
@ SPELLFAMILY_PET
Definition: SharedDefines.h:3545
@ REP_EXALTED
Definition: SharedDefines.h:187
@ SPELL_SCHOOL_MASK_SHADOW
Definition: SharedDefines.h:302
@ SPELL_SCHOOL_MASK_FIRE
Definition: SharedDefines.h:299
@ SPELL_SCHOOL_MASK_FROST
Definition: SharedDefines.h:301
constexpr auto IN_MILLISECONDS
Definition: Common.h:52
int32 irand(int32 min, int32 max)
Definition: Random.cpp:37
T ApplyPct(T &base, U pct)
Definition: Util.h:73
uint8 GetSlot() const
Definition: Item.h:281
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:304
bool IsEquipped() const
Definition: Item.cpp:790
void SetSpellModTakingSpell(Spell *spell, bool apply)
Definition: Player.cpp:10033
void RestoreSpellMods(Spell *spell, uint32 ownerAuraId=0, Aura *aura=nullptr)
Definition: Player.cpp:9891
bool HasSpellCooldown(uint32 spell_id) const override
Definition: Player.cpp:16282
PlayerSpellMap const & GetSpellMap() const
Definition: Player.h:1752
void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient=false, bool forceSendToSpectator=false) override
Definition: Player.cpp:11041
SpellCooldowns GetSpellCooldowns() const
Definition: Player.h:2144
static uint8 GetAttackBySlot(uint8 slot)
Definition: PlayerStorage.cpp:565
ReputationRank GetReputationRank(uint32 faction_id) const
Definition: Player.cpp:5818
Unit * GetSelectedUnit() const
Definition: Player.cpp:11491
void RemoveSpellCooldown(uint32 spell_id, bool update=false)
Definition: Player.cpp:3502
void Say(std::string_view text, Language language, WorldObject const *=nullptr) override
Handles said message in regular chat based on declared language and in config pre-defined Range.
Definition: Player.cpp:9294
Item * GetItemByGuid(ObjectGuid guid) const
Definition: PlayerStorage.cpp:430
Spell * m_spellModTakingSpell
Definition: Player.h:2528
Definition: Unit.h:373
uint32 GetEffectiveHeal() const
Definition: Unit.h:413
uint32 GetCreatePowers(Powers power) const
Definition: Unit.cpp:15587
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5532
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode=AURA_REMOVE_BY_DEFAULT, uint32 except=0)
Definition: Unit.cpp:5204
int32 CalculateSpellDamage(Unit const *target, SpellInfo const *spellProto, uint8 effect_index, int32 const *basePoints=nullptr) const
Definition: Unit.cpp:14778
void SetCantProc(bool apply)
Definition: Unit.h:1664
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:786
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4871
int32 SpellBaseDamageBonusTaken(SpellSchoolMask schoolMask, bool isDoT=false)
Definition: Unit.cpp:11910
bool IsFriendlyTo(Unit const *unit) const
Definition: Unit.cpp:10183
int32 SpellBaseDamageBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:11872
uint32 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:791
void CastDelayedSpellWithPeriodicAmount(Unit *caster, uint32 spellId, AuraType auraType, int32 addAmount, uint8 effectIndex=0)
Definition: Unit.cpp:20210
Powers getPowerType() const
Definition: Unit.h:801
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:5185
void SetMaxDuration(int32 duration)
Definition: SpellAuras.h:130
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:575
int32 GetPowerCost() const
Definition: Spell.h:576
int32 GetMaxDuration() const
Definition: SpellInfo.cpp:2344
uint32 ProcChance
Definition: SpellInfo.h:356
Definition: SpellMgr.h:554
SpellInfo const * last
Definition: SpellMgr.h:558
uint8 rank
Definition: SpellMgr.h:559

References AddPct(), Player::AddSpellCooldown(), AddSpellCooldown(), AddThreat(), ApplyPct(), AURA_REMOVE_BY_ENEMY_SPELL, BASE_ATTACK, SpellInfo::CalcPowerCost(), CalculatePct(), CalculateSpellDamage(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), CastSpell(), CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_HUNTER, CLASS_MAGE, CLASS_PALADIN, CLASS_PRIEST, CLASS_ROGUE, CLASS_SHAMAN, CLASS_WARLOCK, CLASS_WARRIOR, CountPctFromMaxHealth(), CURRENT_GENERIC_SPELL, EFFECT_0, EFFECT_1, SpellInfo::Effects, ObjectGuid::Empty, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, SpellInfo::EquippedItemClass, SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), Player::GetAttackBySlot(), GetAttackTime(), GetAura(), GetAuraEffect(), GetAuraEffectsByType(), AuraEffect::GetBase(), AuraEffect::GetCaster(), Aura::GetCaster(), AuraEffect::GetCasterGUID(), Aura::GetCastItemGUID(), Aura::GetCharges(), getClass(), GetCreateMana(), GetCreatePowers(), WorldObject::GetDistance(), Aura::GetDuration(), Aura::GetEffect(), HealInfo::GetEffectiveHeal(), AuraEffect::GetEffIndex(), Item::GetEnchantmentId(), GameTime::GetGameTime(), Player::GetGroup(), GetGuardianPet(), Object::GetGUID(), ProcEventInfo::GetHealInfo(), Player::GetItemByGuid(), Aura::GetMaxDuration(), SpellInfo::GetMaxDuration(), GetMaxPower(), GetOwner(), Spell::GetPowerCost(), getPowerType(), ProcEventInfo::GetProcSpell(), Player::GetReputationRank(), SpellInfo::GetSchoolMask(), Player::GetSelectedUnit(), Item::GetSlot(), Player::GetSpellCooldowns(), AuraEffect::GetSpellInfo(), Player::GetSpellMap(), Aura::GetStackAmount(), Object::GetTypeId(), GetVictim(), HasActivePowerType(), HasAura(), Position::HasInArc(), Player::HasSpellCooldown(), HasSpellCooldown(), haveOffhandWeapon(), HealthBelowPct(), SpellInfo::Id, IN_MILLISECONDS, irand(), IsAlive(), Item::IsEquipped(), IsFriendlyTo(), Object::IsPlayer(), SpellInfo::IsPositive(), SpellInfo::IsRankOf(), LANG_UNIVERSAL, SpellChainNode::last, LOG_ERROR, m_currentSpells, Player::m_spellModTakingSpell, SpellInfo::ManaCost, MAX_SPELL_EFFECTS, MECHANIC_ROOT, MECHANIC_SNARE, MECHANIC_STUN, OFF_ATTACK, PLAYERSPELL_REMOVED, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, PROC_EX_CRITICAL_HIT, PROC_EX_INTERNAL_HOT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_MAINHAND_ATTACK, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, SpellInfo::ProcChance, RAND(), SpellChainNode::rank, RemoveAura(), RemoveAuraFromStack(), RemoveAurasByType(), RemoveAurasDueToSpell(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), Player::RemoveSpellCooldown(), REP_EXALTED, Player::RestoreSpellMods(), roll_chance_f(), roll_chance_i(), Player::Say(), SpellInfo::SchoolMask, AuraEffect::SetAmount(), SetCantProc(), Aura::SetDuration(), Aura::SetMaxDuration(), Player::SetSpellModTakingSpell(), SPELL_AURA_DUMMY, SPELL_AURA_HASTE_SPELLS, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_DUMMY, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_EFFECT_ENERGIZE, SPELL_EFFECT_HEAL, SPELL_SCHOOL_MASK_FIRE, SPELL_SCHOOL_MASK_FROST, SPELL_SCHOOL_MASK_NORMAL, SPELL_SCHOOL_MASK_SHADOW, SpellBaseDamageBonusDone(), SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PET, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, SPELLVALUE_BASE_POINT0, SpellInfo::SpellVisual, sSpellMgr, TEMP_ENCHANTMENT_SLOT, Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and urand().

Referenced by ProcDamageAndSpellFor().

◆ HandleEmoteCommand()

void Unit::HandleEmoteCommand ( uint32  emoteId)
1968{
1970 packet.EmoteID = emoteId;
1971 packet.Guid = GetGUID();
1972 SendMessageToSet(packet.Write(), true);
1973}
Definition: ChatPackets.h:29
WorldPacket const * Write() override
Definition: ChatPackets.cpp:20
uint32 EmoteID
Definition: ChatPackets.h:35
ObjectGuid Guid
Definition: ChatPackets.h:36

References WorldPackets::Chat::Emote::EmoteID, Object::GetGUID(), WorldPackets::Chat::Emote::Guid, WorldObject::SendMessageToSet(), and WorldPackets::Chat::Emote::Write().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), boss_viscidus::DamageTaken(), DealMeleeDamage(), boss_twinemperorsAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), StandUpEvent::Execute(), PartyTimeEmoteEvent::Execute(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), WorldSession::HandleEmoteOpcode(), npc_commandscript::HandleNpcSayCommand(), npc_commandscript::HandleNpcYellCommand(), WorldSession::HandleTextEmoteOpcode(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), npc_sentinel_leader::MovementInform(), npc_sentinel_infiltrator::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), npc_kalecgos::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), spell_gen_spectator_cheer_trigger::PrepareSpellScript(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), PetAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), CreatureTextMgr::SendEmote(), boss_grand_warlock_nethekurse::SetData(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_ahune::Submerge(), boss_nightbane::TriggerHealthTakeOff(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_shenthul::npc_shenthulAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_highlord_tirion_fordring_lh::npc_highlord_tirion_fordringAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_valiance_keep_cannoneer::npc_valiance_keep_cannoneerAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_dancing_flames::npc_dancing_flamesAI::UpdateAI(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::UpdateAI(), npc_rocknot::npc_rocknotAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_taretha::npc_tarethaAI::WaypointReached(), npc_general_andorov::WaypointReached(), npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached(), npc_engineer_helice::npc_engineer_heliceAI::WaypointReached(), npc_maxx_a_million_escort::npc_maxx_a_million_escortAI::WaypointReached(), and npc_isla_starmane::npc_isla_starmaneAI::WaypointReached().

◆ HandleOverrideClassScriptAuraProc()

bool Unit::HandleOverrideClassScriptAuraProc ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  cooldown 
)
private
9804{
9805 int32 scriptId = triggeredByAura->GetMiscValue();
9806
9807 if (!victim || !victim->IsAlive())
9808 return false;
9809
9810 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer()
9811 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
9812
9813 uint32 triggered_spell_id = 0;
9814
9815 switch (scriptId)
9816 {
9817 case 836: // Improved Blizzard (Rank 1)
9818 {
9819 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9820 return false;
9821 triggered_spell_id = 12484;
9822 break;
9823 }
9824 case 988: // Improved Blizzard (Rank 2)
9825 {
9826 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9827 return false;
9828 triggered_spell_id = 12485;
9829 break;
9830 }
9831 case 989: // Improved Blizzard (Rank 3)
9832 {
9833 if (!procSpell || procSpell->SpellVisual[0] != 9487)
9834 return false;
9835 triggered_spell_id = 12486;
9836 break;
9837 }
9838 case 4533: // Dreamwalker Raiment 2 pieces bonus
9839 {
9840 // Chance 50%
9841 if (!roll_chance_i(50))
9842 return false;
9843
9844 switch (victim->getPowerType())
9845 {
9846 case POWER_MANA:
9847 triggered_spell_id = 28722;
9848 break;
9849 case POWER_RAGE:
9850 triggered_spell_id = 28723;
9851 break;
9852 case POWER_ENERGY:
9853 triggered_spell_id = 28724;
9854 break;
9855 default:
9856 return false;
9857 }
9858 break;
9859 }
9860 case 4537: // Dreamwalker Raiment 6 pieces bonus
9861 triggered_spell_id = 28750; // Blessing of the Claw
9862 break;
9863 case 5497: // Improved Mana Gems
9864 triggered_spell_id = 37445; // Mana Surge
9865 break;
9866 case 7010: // Revitalize - can proc on full hp target
9867 case 7011:
9868 case 7012:
9869 {
9870 if (!roll_chance_i(triggeredByAura->GetAmount()))
9871 return false;
9872 switch (victim->getPowerType())
9873 {
9874 case POWER_MANA:
9875 triggered_spell_id = 48542;
9876 break;
9877 case POWER_RAGE:
9878 triggered_spell_id = 48541;
9879 break;
9880 case POWER_ENERGY:
9881 triggered_spell_id = 48540;
9882 break;
9883 case POWER_RUNIC_POWER:
9884 triggered_spell_id = 48543;
9885 break;
9886 default:
9887 break;
9888 }
9889 break;
9890 }
9891 default:
9892 break;
9893 }
9894
9895 // not processed
9896 if (!triggered_spell_id)
9897 return false;
9898
9899 // standard non-dummy case
9900 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id);
9901
9902 if (!triggerEntry)
9903 {
9904 LOG_ERROR("entities.unit", "Unit::HandleOverrideClassScriptAuraProc: Spell {} triggering for class script id {}", triggered_spell_id, scriptId);
9905 return false;
9906 }
9907
9908 if (cooldown)
9909 {
9910 if (HasSpellCooldown(triggered_spell_id))
9911 return false;
9912
9913 AddSpellCooldown(triggered_spell_id, 0, cooldown);
9914 }
9915
9916 CastSpell(victim, triggered_spell_id, true, castItem, triggeredByAura);
9917
9918 return true;
9919}

References AddSpellCooldown(), CastSpell(), AuraEffect::GetAmount(), AuraEffect::GetBase(), Aura::GetCastItemGUID(), Player::GetItemByGuid(), AuraEffect::GetMiscValue(), getPowerType(), HasSpellCooldown(), IsAlive(), Object::IsPlayer(), LOG_ERROR, POWER_ENERGY, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, roll_chance_i(), SpellInfo::SpellVisual, sSpellMgr, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ HandleProcExtraAttackFor()

void Unit::HandleProcExtraAttackFor ( Unit victim,
uint32  count 
)
2724{
2725 while (count)
2726 {
2727 --count;
2728 AttackerStateUpdate(victim, BASE_ATTACK, true);
2729 }
2730}
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition: Unit.cpp:2532

References AttackerStateUpdate(), and BASE_ATTACK.

Referenced by Update().

◆ HandleProcTriggerSpell()

bool Unit::HandleProcTriggerSpell ( Unit victim,
uint32  damage,
AuraEffect triggeredByAura,
SpellInfo const *  procSpell,
uint32  procFlag,
uint32  procEx,
uint32  cooldown,
uint32  procPhase,
ProcEventInfo eventInfo 
)
private
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
8877{
8878 // Get triggered aura spell info
8879 SpellInfo const* auraSpellInfo = triggeredByAura->GetSpellInfo();
8880
8881 // Basepoints of trigger aura
8882 int32 triggerAmount = triggeredByAura->GetAmount();
8883
8884 // Set trigger spell id, target, custom basepoints
8885 uint32 trigger_spell_id = auraSpellInfo->Effects[triggeredByAura->GetEffIndex()].TriggerSpell;
8886
8887 Unit* target = nullptr;
8888 int32 basepoints0 = 0;
8889
8890 if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
8891 basepoints0 = triggerAmount;
8892
8893 Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && IsPlayer()
8894 ? ToPlayer()->GetItemByGuid(triggeredByAura->GetBase()->GetCastItemGUID()) : nullptr;
8895
8896 // Try handle unknown trigger spells
8897 //if (sSpellMgr->GetSpellInfo(trigger_spell_id) == nullptr)
8898 {
8899 switch (auraSpellInfo->SpellFamilyName)
8900 {
8902 switch (auraSpellInfo->Id)
8903 {
8904 case 43820: // Charm of the Witch Doctor (Amani Charm of the Witch Doctor trinket)
8905 // Pct value stored in dummy
8906 if (!victim)
8907 return false;
8908 basepoints0 = victim->GetCreateHealth() * auraSpellInfo->Effects[1].CalcValue() / 100;
8909 target = victim;
8910 break;
8911 case 57345: // Darkmoon Card: Greatness
8912 {
8913 float stat = 0.0f;
8914 // strength
8915 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 60229; stat = GetStat(STAT_STRENGTH); }
8916 // agility
8917 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 60233; stat = GetStat(STAT_AGILITY); }
8918 // intellect
8919 if (GetStat(STAT_INTELLECT) > stat) { trigger_spell_id = 60234; stat = GetStat(STAT_INTELLECT);}
8920 // spirit
8921 if (GetStat(STAT_SPIRIT) > stat) { trigger_spell_id = 60235; }
8922 break;
8923 }
8924 case 67702: // Death's Choice, Item - Coliseum 25 Normal Melee Trinket
8925 {
8926 if (!damage)
8927 return false;
8928 float stat = 0.0f;
8929 // strength
8930 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67708; stat = GetStat(STAT_STRENGTH); }
8931 // agility
8932 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67703; }
8933 break;
8934 }
8935 case 67771: // Death's Choice (heroic), Item - Coliseum 25 Heroic Melee Trinket
8936 {
8937 if (!damage)
8938 return false;
8939 float stat = 0.0f;
8940 // strength
8941 if (GetStat(STAT_STRENGTH) > stat) { trigger_spell_id = 67773; stat = GetStat(STAT_STRENGTH); }
8942 // agility
8943 if (GetStat(STAT_AGILITY) > stat) { trigger_spell_id = 67772; }
8944 break;
8945 }
8946 // Mana Drain Trigger
8947 case 27522:
8948 case 40336:
8949 {
8950 // On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target.
8951 if (IsAlive())
8952 CastSpell(this, 29471, true, castItem, triggeredByAura);
8953 if (victim && victim->IsAlive())
8954 CastSpell(victim, 27526, true, castItem, triggeredByAura);
8955 return true;
8956 }
8957 // Forge of Souls, Devourer of Souls, Mirrored Soul
8958 case 69023:
8959 {
8960 int32 dmg = damage * 0.45f;
8961 if (dmg > 0)
8962 if (Aura* a = GetAura(69023))
8963 if (Unit* c = a->GetCaster())
8964 CastCustomSpell(c, 69034, &dmg, 0, 0, true);
8965 return true;
8966 }
8967 // Soul-Trader Beacon proc aura
8968 case 50051:
8969 {
8970 if (!victim)
8971 return false;
8972
8974 cr->CastSpell(victim, 50101, true);
8975
8976 return false;
8977 }
8978 }
8979 break;
8980 case SPELLFAMILY_MAGE:
8981 if (auraSpellInfo->SpellIconID == 2127) // Blazing Speed
8982 {
8983 switch (auraSpellInfo->Id)
8984 {
8985 case 31641: // Rank 1
8986 case 31642: // Rank 2
8987 trigger_spell_id = 31643;
8988 break;
8989 default:
8990 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} miss posibly Blazing Speed", auraSpellInfo->Id);
8991 return false;
8992 }
8993 }
8994 else if (auraSpellInfo->Id == 71761) // Deep Freeze Immunity State (only permanent)
8995 {
8996 Creature* creature = victim->ToCreature();
8997 if (!creature || !creature->HasMechanicTemplateImmunity(1 << (MECHANIC_STUN - 1)))
8998 return false;
8999 }
9000 break;
9002 {
9003 // Nether Protection
9004 if (auraSpellInfo->SpellIconID == 1985)
9005 {
9006 if (!procSpell)
9007 return false;
9008 switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
9009 {
9011 return false; // ignore
9012 case SPELL_SCHOOL_HOLY:
9013 trigger_spell_id = 54370;
9014 break;
9015 case SPELL_SCHOOL_FIRE:
9016 trigger_spell_id = 54371;
9017 break;
9019 trigger_spell_id = 54375;
9020 break;
9021 case SPELL_SCHOOL_FROST:
9022 trigger_spell_id = 54372;
9023 break;
9025 trigger_spell_id = 54374;
9026 break;
9028 trigger_spell_id = 54373;
9029 break;
9030 default:
9031 return false;
9032 }
9033 }
9034 break;
9035 }
9036 case SPELLFAMILY_PRIEST:
9037 {
9038 // Blessed Recovery
9039 if (auraSpellInfo->SpellIconID == 1875)
9040 {
9041 switch (auraSpellInfo->Id)
9042 {
9043 case 27811:
9044 trigger_spell_id = 27813;
9045 break;
9046 case 27815:
9047 trigger_spell_id = 27817;
9048 break;
9049 case 27816:
9050 trigger_spell_id = 27818;
9051 break;
9052 default:
9053 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} not handled in BR", auraSpellInfo->Id);
9054 return false;
9055 }
9056 basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3;
9057 target = this;
9058 // Add remaining ticks to healing done
9059 CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_HEAL, basepoints0);
9060 return true;
9061 }
9062 break;
9063 }
9064 case SPELLFAMILY_DRUID:
9065 {
9066 switch (auraSpellInfo->Id)
9067 {
9068 // Druid Forms Trinket
9069 case 37336:
9070 {
9071 switch (GetShapeshiftForm())
9072 {
9073 case FORM_NONE:
9074 trigger_spell_id = 37344;
9075 break;
9076 case FORM_CAT:
9077 trigger_spell_id = 37341;
9078 break;
9079 case FORM_BEAR:
9080 case FORM_DIREBEAR:
9081 trigger_spell_id = 37340;
9082 break;
9083 case FORM_TREE:
9084 trigger_spell_id = 37342;
9085 break;
9086 case FORM_MOONKIN:
9087 trigger_spell_id = 37343;
9088 break;
9089 default:
9090 return false;
9091 }
9092 break;
9093 }
9094 // Druid T9 Feral Relic (Lacerate, Swipe, Mangle, and Shred)
9095 case 67353:
9096 {
9097 switch (GetShapeshiftForm())
9098 {
9099 case FORM_CAT:
9100 trigger_spell_id = 67355;
9101 break;
9102 case FORM_BEAR:
9103 case FORM_DIREBEAR:
9104 trigger_spell_id = 67354;
9105 break;
9106 default:
9107 return false;
9108 }
9109 break;
9110 }
9111 default:
9112 break;
9113 }
9114 break;
9115 }
9116 case SPELLFAMILY_HUNTER:
9117 {
9118 if (auraSpellInfo->SpellIconID == 3247) // Piercing Shots
9119 {
9120 if (!victim)
9121 return false;
9122
9123 switch (auraSpellInfo->Id)
9124 {
9125 case 53234: // Rank 1
9126 case 53237: // Rank 2
9127 case 53238: // Rank 3
9128 trigger_spell_id = 63468;
9129 break;
9130 default:
9131 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} miss posibly Piercing Shots", auraSpellInfo->Id);
9132 return false;
9133 }
9134 SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id);
9135 if (!TriggerPS)
9136 return false;
9137
9138 basepoints0 = CalculatePct(int32(damage), triggerAmount) / (TriggerPS->GetMaxDuration() / TriggerPS->Effects[0].Amplitude);
9139 victim->CastDelayedSpellWithPeriodicAmount(this, trigger_spell_id, SPELL_AURA_PERIODIC_DAMAGE, basepoints0);
9140 return true;
9141 }
9142 // Item - Hunter T9 4P Bonus (Steady Shot)
9143 else if (auraSpellInfo->Id == 67151)
9144 {
9145 if (GetTypeId() != TYPEID_PLAYER || !ToPlayer()->GetPet())
9146 return false;
9147
9148 target = ToPlayer()->GetPet();
9149 trigger_spell_id = 68130;
9150 break;
9151 }
9152 break;
9153 }
9155 {
9156 switch (auraSpellInfo->Id)
9157 {
9158 // Soul Preserver
9159 case 60510:
9160 {
9161 switch (getClass())
9162 {
9163 case CLASS_DRUID:
9164 trigger_spell_id = 60512;
9165 break;
9166 case CLASS_PALADIN:
9167 trigger_spell_id = 60513;
9168 break;
9169 case CLASS_PRIEST:
9170 trigger_spell_id = 60514;
9171 break;
9172 case CLASS_SHAMAN:
9173 trigger_spell_id = 60515;
9174 break;
9175 }
9176
9177 target = this;
9178 break;
9179 }
9180 case 37657: // Lightning Capacitor
9181 case 54841: // Thunder Capacitor
9182 case 67712: // Item - Coliseum 25 Normal Caster Trinket
9183 case 67758: // Item - Coliseum 25 Heroic Caster Trinket
9184 {
9185 if (!victim || !victim->IsAlive() || GetTypeId() != TYPEID_PLAYER)
9186 return false;
9187
9188 uint32 stack_spell_id = 0;
9189 switch (auraSpellInfo->Id)
9190 {
9191 case 37657:
9192 stack_spell_id = 37658;
9193 trigger_spell_id = 37661;
9194 break;
9195 case 54841:
9196 stack_spell_id = 54842;
9197 trigger_spell_id = 54843;
9198 break;
9199 case 67712:
9200 stack_spell_id = 67713;
9201 trigger_spell_id = 67714;
9202 break;
9203 case 67758:
9204 stack_spell_id = 67759;
9205 trigger_spell_id = 67760;
9206 break;
9207 }
9208
9209 if (cooldown && ToPlayer()->HasSpellCooldown(stack_spell_id))
9210 {
9211 return false;
9212 }
9213
9214 CastSpell(this, stack_spell_id, true, nullptr, triggeredByAura);
9215
9216 Aura* dummy = GetAura(stack_spell_id);
9217 if (!dummy || dummy->GetStackAmount() < triggerAmount)
9218 {
9219 return false;
9220 }
9221
9222 if (cooldown)
9223 {
9224 ToPlayer()->AddSpellCooldown(stack_spell_id, 0, cooldown);
9225 }
9226 RemoveAurasDueToSpell(stack_spell_id);
9227 CastSpell(victim, trigger_spell_id, true, nullptr, triggeredByAura);
9228 return true;
9229 }
9230 default:
9231 // Illumination
9232 if (auraSpellInfo->SpellIconID == 241)
9233 {
9234 if (!procSpell)
9235 return false;
9236 // procspell is triggered spell but we need mana cost of original casted spell
9237 uint32 originalSpellId = procSpell->Id;
9238 // Holy Shock heal
9239 if (procSpell->SpellFamilyFlags[1] & 0x00010000)
9240 {
9241 switch (procSpell->Id)
9242 {
9243 case 25914:
9244 originalSpellId = 20473;
9245 break;
9246 case 25913:
9247 originalSpellId = 20929;
9248 break;
9249 case 25903:
9250 originalSpellId = 20930;
9251 break;
9252 case 27175:
9253 originalSpellId = 27174;
9254 break;
9255 case 33074:
9256 originalSpellId = 33072;
9257 break;
9258 case 48820:
9259 originalSpellId = 48824;
9260 break;
9261 case 48821:
9262 originalSpellId = 48825;
9263 break;
9264 default:
9265 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} not handled in HShock", procSpell->Id);
9266 return false;
9267 }
9268 }
9269 SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId);
9270 if (!originalSpell)
9271 {
9272 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} unknown but selected as original in Illu", originalSpellId);
9273 return false;
9274 }
9275 // percent stored in effect 1 (class scripts) base points
9276 int32 cost = int32(originalSpell->ManaCost + CalculatePct(GetCreateMana(), originalSpell->ManaCostPercentage));
9277 basepoints0 = CalculatePct(cost, auraSpellInfo->Effects[1].CalcValue());
9278 trigger_spell_id = 20272;
9279 target = this;
9280 }
9281 break;
9282 }
9283 break;
9284 }
9285 case SPELLFAMILY_SHAMAN:
9286 {
9287 // Lightning Shield (overwrite non existing triggered spell call in spell.dbc
9288 if (auraSpellInfo->SpellFamilyFlags[0] & 0x400 && auraSpellInfo->HasAttribute(SPELL_ATTR1_NO_THREAT))
9289 {
9290 // Do not proc off from self-casted items
9291 if (Spell const* spell = eventInfo.GetProcSpell())
9292 {
9293 if (spell->m_castItemGUID && victim->GetGUID() == GetGUID())
9294 {
9295 return false;
9296 }
9297 }
9298
9299 trigger_spell_id = sSpellMgr->GetSpellWithRank(26364, auraSpellInfo->GetRank());
9300 }
9301 // Nature's Guardian
9302 else if (auraSpellInfo->SpellIconID == 2013)
9303 {
9304 // Check health condition - should drop to less 30% (damage deal after this!)
9305 if (!HealthBelowPctDamaged(30, damage))
9306 return false;
9307
9308 if (victim && victim->IsAlive())
9309 victim->GetThreatMgr().ModifyThreatByPercent(this, -10);
9310
9311 basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
9312 trigger_spell_id = 31616;
9313 target = this;
9314 }
9315 break;
9316 }
9318 {
9319 // Acclimation
9320 if (auraSpellInfo->SpellIconID == 1930)
9321 {
9322 if (!procSpell)
9323 return false;
9324 switch (GetFirstSchoolInMask(procSpell->GetSchoolMask()))
9325 {
9327 return false; // ignore
9328 case SPELL_SCHOOL_HOLY:
9329 trigger_spell_id = 50490;
9330 break;
9331 case SPELL_SCHOOL_FIRE:
9332 trigger_spell_id = 50362;
9333 break;
9335 trigger_spell_id = 50488;
9336 break;
9337 case SPELL_SCHOOL_FROST:
9338 trigger_spell_id = 50485;
9339 break;
9341 trigger_spell_id = 50489;
9342 break;
9344 trigger_spell_id = 50486;
9345 break;
9346 default:
9347 return false;
9348 }
9349 }
9350 // Blood Presence (Improved)
9351 else if (auraSpellInfo->Id == 63611)
9352 {
9353 if (GetTypeId() != TYPEID_PLAYER)
9354 return false;
9355
9356 trigger_spell_id = 50475;
9357 basepoints0 = CalculatePct(int32(damage), triggerAmount);
9358 }
9359 break;
9360 }
9361 }
9362 }
9363
9364 // All ok. Check current trigger spell
9365 SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(trigger_spell_id);
9366 if (!triggerEntry)
9367 {
9368 // Don't cast unknown spell
9369 LOG_ERROR("entities.unit", "Unit::HandleProcTriggerSpell: Spell {} (effIndex: {}) has unknown TriggerSpell {}. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex(), trigger_spell_id);
9370 return false;
9371 }
9372
9373 // not allow proc extra attack spell at extra attack
9374 if (triggerEntry->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
9375 {
9376 uint32 lastExtraAttackSpell = eventInfo.GetActor()->GetLastExtraAttackSpell();
9377
9378 // Patch 1.12.0(?) extra attack abilities can no longer chain proc themselves
9379 if (lastExtraAttackSpell == trigger_spell_id)
9380 {
9381 return false;
9382 }
9383
9384 // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks
9385 // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue)
9386 if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH)
9387 {
9388 return false;
9389 }
9390 }
9391
9392 // Custom requirements (not listed in procEx) Warning! damage dealing after this
9393 // Custom triggered spells
9394 switch (auraSpellInfo->Id)
9395 {
9396 // Deep Wounds
9397 case 12834:
9398 case 12849:
9399 case 12867:
9400 {
9401 if (GetTypeId() != TYPEID_PLAYER)
9402 return false;
9403
9404 if (procFlags & PROC_FLAG_DONE_OFFHAND_ATTACK)
9406 else
9408 break;
9409 }
9410 // Persistent Shield (Scarab Brooch trinket)
9411 // This spell originally trigger 13567 - Dummy Trigger (vs dummy efect)
9412 case 26467:
9413 {
9414 basepoints0 = int32(CalculatePct(damage, 15));
9415 target = victim;
9416 trigger_spell_id = 26470;
9417 break;
9418 }
9419 // Unyielding Knights (item exploit 29108\29109)
9420 case 38164:
9421 {
9422 if (!victim || victim->GetEntry() != 19457) // Proc only if your target is Grillok
9423 return false;
9424 break;
9425 }
9426 // Deflection
9427 case 52420:
9428 {
9429 if (!HealthBelowPct(35))
9430 return false;
9431 break;
9432 }
9433
9434 // Cheat Death
9435 case 28845:
9436 {
9437 // When your health drops below 20%
9438 if (HealthBelowPctDamaged(20, damage) || HealthBelowPct(20))
9439 return false;
9440 break;
9441 }
9442 // Deadly Swiftness (Rank 1)
9443 case 31255:
9444 {
9445 // whenever you deal damage to a target who is below 20% health.
9446 if (!victim || !victim->IsAlive() || victim->HealthAbovePct(20))
9447 return false;
9448
9449 target = this;
9450 trigger_spell_id = 22588;
9451 [[fallthrough]];
9452 }
9453 // Bonus Healing (Crystal Spire of Karabor mace)
9454 case 40971:
9455 {
9456 // If your target is below $s1% health
9457 if (!victim || !victim->IsAlive() || victim->HealthAbovePct(triggerAmount))
9458 return false;
9459 break;
9460 }
9461 // Rapid Recuperation
9462 case 53228:
9463 case 53232:
9464 {
9465 // This effect only from Rapid Fire (ability cast)
9466 if (!procSpell || !(procSpell->SpellFamilyFlags[0] & 0x20))
9467 return false;
9468 break;
9469 }
9470 // Decimation
9471 case 63156:
9472 case 63158:
9473 // Can proc only if target has hp below 35%
9474 if (!victim || !victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this))
9475 return false;
9476 break;
9477 // Ulduar, Hodir, Toasty Fire
9478 case 62821:
9479 if (this->GetTypeId() != TYPEID_PLAYER) // spell has Attribute, but persistent area auras ignore it
9480 return false;
9481 break;
9482 case 15337: // Improved Spirit Tap (Rank 1)
9483 case 15338: // Improved Spirit Tap (Rank 2)
9484 {
9485 if (!procSpell)
9486 return false;
9487
9488 if (procSpell->SpellFamilyFlags[0] & 0x800000)
9489 if ((procSpell->Id != 58381) || !roll_chance_i(50))
9490 return false;
9491
9492 target = victim;
9493 break;
9494 }
9495 // Professor Putricide - Ooze Spell Tank Protection
9496 case 71770:
9497 if (victim)
9498 victim->CastSpell(victim, trigger_spell_id, true); // EffectImplicitTarget is self
9499 return true;
9500 case 45057: // Evasive Maneuvers (Commendation of Kael`thas trinket)
9501 case 71634: // Item - Icecrown 25 Normal Tank Trinket 1
9502 case 71640: // Item - Icecrown 25 Heroic Tank Trinket 1
9503 case 75475: // Item - Chamber of Aspects 25 Normal Tank Trinket
9504 case 75481: // Item - Chamber of Aspects 25 Heroic Tank Trinket
9505 {
9506 // Procs only if damage takes health below $s1%
9507 if (!HealthBelowPctDamaged(triggerAmount, damage))
9508 return false;
9509 break;
9510 }
9511 default:
9512 break;
9513 }
9514
9515 if (auraSpellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
9516 {
9517 // Xinef: keep this order, Aura 70656 has SpellIconID 85!
9518 // Item - Death Knight T10 Melee 4P Bonus
9519 if (auraSpellInfo->Id == 70656)
9520 {
9522 return false;
9523
9524 for (uint8 i = 0; i < MAX_RUNES; ++i)
9525 if (ToPlayer()->GetRuneCooldown(i) == 0)
9526 return false;
9527 }
9528 // Blade Barrier
9529 else if (auraSpellInfo->SpellIconID == 85)
9530 {
9531 Player* plr = ToPlayer();
9532 if (!plr || !plr->IsClass(CLASS_DEATH_KNIGHT, CLASS_CONTEXT_ABILITY) || !procSpell)
9533 return false;
9534
9536 return false;
9537 }
9538 // Rime
9539 else if (auraSpellInfo->SpellIconID == 56)
9540 {
9541 if (GetTypeId() != TYPEID_PLAYER)
9542 return false;
9543
9544 // Howling Blast
9546 }
9547 }
9548
9549 // Custom basepoints/target for exist spell
9550 // dummy basepoints or other customs
9551 switch (trigger_spell_id)
9552 {
9553 // Auras which should proc on area aura source (caster in this case):
9554 // Turn the Tables
9555 case 52914:
9556 case 52915:
9557 case 52910:
9558 // Honor Among Thieves
9559 case 51699:
9560 {
9561 target = triggeredByAura->GetBase()->GetCaster();
9562 if (!target)
9563 return false;
9564
9565 if (Player* pTarget = target->ToPlayer())
9566 {
9567 if (cooldown)
9568 {
9569 if (pTarget->HasSpellCooldown(trigger_spell_id) )
9570 return false;
9571 pTarget->AddSpellCooldown(trigger_spell_id, 0, cooldown);
9572 }
9573
9574 Unit* cptarget = nullptr;
9575 if (trigger_spell_id == 51699)
9576 {
9577 cptarget = pTarget->GetComboTarget();
9578 if (!cptarget)
9579 {
9580 cptarget = pTarget->GetSelectedUnit();
9581 }
9582 }
9583 else
9584 cptarget = target;
9585
9586 if (cptarget)
9587 {
9588 target->CastSpell(cptarget, trigger_spell_id, true);
9589 return true;
9590 }
9591 }
9592 return false;
9593 }
9594 // Cast positive spell on enemy target
9595 case 7099: // Curse of Mending
9596 case 39703: // Curse of Mending
9597 case 20233: // Improved Lay on Hands (cast on target)
9598 {
9599 target = victim;
9600 break;
9601 }
9602 // Ruby Drake, Evasive Aura
9603 case 50241:
9604 {
9605 if( GetAura(50240) )
9606 return false;
9607
9608 break;
9609 }
9610 // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset)
9611 case 15250: // Rogue Setup
9612 {
9613 // applied only for main target
9614 if (!victim || (IsPlayer() && victim != ToPlayer()->GetSelectedUnit()))
9615 return false;
9616 break; // continue normal case
9617 }
9618 // Finish movies that add combo
9619 case 14189: // Seal Fate (Netherblade set)
9620 case 14157: // Ruthlessness
9621 {
9622 victim = nullptr;
9623 // Need add combopoint AFTER finish movie (or they dropped in finish phase)
9624 break;
9625 }
9626 // Item - Druid T10 Balance 2P Bonus
9627 case 16870:
9628 {
9629 if (HasAura(70718))
9630 CastSpell(this, 70721, true);
9631 RemoveAurasDueToSpell(trigger_spell_id);
9632 break;
9633 }
9634 // Shamanistic Rage triggered spell
9635 case 30824:
9636 {
9637 basepoints0 = int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), triggerAmount));
9638 break;
9639 }
9640 // Enlightenment (trigger only from mana cost spells)
9641 case 35095:
9642 {
9643 if (!procSpell || procSpell->PowerType != POWER_MANA || (procSpell->ManaCost == 0 && procSpell->ManaCostPercentage == 0 && procSpell->ManaCostPerlevel == 0))
9644 return false;
9645 break;
9646 }
9647 case 46916: // Slam! (Bloodsurge proc)
9648 case 52437: // Sudden Death
9649 {
9650 // Item - Warrior T10 Melee 4P Bonus
9651 if (AuraEffect const* aurEff = GetAuraEffect(70847, 0))
9652 {
9653 if (!roll_chance_i(aurEff->GetAmount()))
9654 {
9655 // Xinef: dont allow normal proc to override set one
9656 if (GetAura((trigger_spell_id == 46916) ? 71072 : 71069))
9657 return false;
9658 // Xinef: just to be sure
9659 RemoveAurasDueToSpell(70849);
9660 break;
9661 }
9662
9663 // Xinef: fully remove all auras and reapply once more
9664 RemoveAurasDueToSpell(70849);
9665 RemoveAurasDueToSpell(71072);
9666 RemoveAurasDueToSpell(71069);
9667
9668 CastSpell(this, 70849, true, castItem, triggeredByAura); // Extra Charge!
9669 if (trigger_spell_id == 46916)
9670 CastSpell(this, 71072, true, castItem, triggeredByAura); // Slam GCD Reduced
9671 else
9672 CastSpell(this, 71069, true, castItem, triggeredByAura); // Execute GCD Reduced
9673 }
9674 break;
9675 }
9676 // Sword and Board
9677 case 50227:
9678 {
9679 // Remove cooldown on Shield Slam
9680 if (IsPlayer())
9682 break;
9683 }
9684 // Maelstrom Weapon
9685 case 53817:
9686 {
9687 // have rank dependent proc chance, ignore too often cases
9688 // PPM = 2.5 * (rank of talent),
9689 uint32 rank = auraSpellInfo->GetRank();
9690 // 5 rank -> 100% 4 rank -> 80% and etc from full rate
9691 if (!roll_chance_i(20 * rank))
9692 return false;
9693
9694 // Item - Shaman T10 Enhancement 4P Bonus
9695 if (AuraEffect const* aurEff = GetAuraEffect(70832, 0))
9696 if (Aura const* maelstrom = GetAura(53817))
9697 // xinef: we have 4 charges and all proc conditions are met - aura reaches 5 charges
9698 if ((maelstrom->GetStackAmount() == 4) && roll_chance_i(aurEff->GetAmount()))
9699 CastSpell(this, 70831, true, castItem, triggeredByAura);
9700
9701 break;
9702 }
9703 // Astral Shift
9704 case 52179:
9705 {
9706 if (!procSpell || !(procEx & (PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT)) || this == victim)
9707 return false;
9708
9709 // Need stun, fear or silence mechanic
9710 if (!(procSpell->GetAllEffectsMechanicMask() & ((1 << MECHANIC_SILENCE) | (1 << MECHANIC_STUN) | (1 << MECHANIC_FEAR))))
9711 return false;
9712 break;
9713 }
9714 // Glyph of Death's Embrace
9715 case 58679:
9716 {
9717 // Proc only from healing part of Death Coil. Check is essential as all Death Coil spells have 0x2000 mask in SpellFamilyFlags
9718 if (!procSpell || !(procSpell->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && procSpell->SpellFamilyFlags[0] == 0x80002000))
9719 return false;
9720 break;
9721 }
9722 // Glyph of Death Grip
9723 case 58628:
9724 {
9725 // remove cooldown of Death Grip
9726 if (IsPlayer())
9727 ToPlayer()->RemoveSpellCooldown(49576, true);
9728 return true;
9729 }
9730 // Savage Defense
9731 case 62606:
9732 {
9733 basepoints0 = CalculatePct(triggerAmount, GetTotalAttackPowerValue(BASE_ATTACK));
9734 break;
9735 }
9736 // Body and Soul
9737 case 64128:
9738 case 65081:
9739 {
9740 // Proc only from PW:S cast
9741 if (!procSpell || !(procSpell->SpellFamilyFlags[0] & 0x00000001))
9742 return false;
9743 break;
9744 }
9745 // Culling the Herd
9746 case 70893:
9747 {
9748 if (!procSpell)
9749 {
9750 return false;
9751 }
9752 // check if we're doing a critical hit
9753 if (!(procSpell->SpellFamilyFlags[1] & 0x10000000) && (procEx != PROC_EX_CRITICAL_HIT))
9754 return false;
9755 // check if we're procced by Claw, Bite or Smack (need to use the spell icon ID to detect it)
9756 if (!(procSpell->SpellIconID == 262 || procSpell->SpellIconID == 1680 || procSpell->SpellIconID == 473))
9757 return false;
9758 break;
9759 }
9760 // Fingers of Frost, synchronise with Frostbite
9761 case 44544:
9762 {
9763 if (procPhase == PROC_SPELL_PHASE_HIT)
9764 {
9765 // Find Frostbite
9767 {
9768 if (!victim)
9769 return false;
9770
9771 uint8 fofRank = sSpellMgr->GetSpellRank(triggeredByAura->GetId());
9772 uint8 fbRank = sSpellMgr->GetSpellRank(aurEff->GetId());
9773 uint8 chance = uint8(std::ceil(fofRank * fbRank * 16.6f));
9774
9775 if (roll_chance_i(chance))
9776 CastSpell(victim, aurEff->GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, true);
9777 }
9778 }
9779 break;
9780 }
9781 }
9782
9783 // try detect target manually if not set
9784 if (!target)
9785 target = !(procFlags & (PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS)) && triggerEntry->IsPositive() ? this : victim;
9786
9787 if (cooldown)
9788 {
9789 if (HasSpellCooldown(triggerEntry->Id))
9790 return false;
9791
9792 AddSpellCooldown(triggerEntry->Id, 0, cooldown);
9793 }
9794
9795 if(basepoints0)
9796 CastCustomSpell(target, triggerEntry->Id, &basepoints0, nullptr, nullptr, true, castItem, triggeredByAura);
9797 else
9798 CastSpell(target, triggerEntry->Id, true, castItem, triggeredByAura);
9799
9800 return true;
9801}
@ PROC_SPELL_PHASE_HIT
Definition: SpellMgr.h:244
@ SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
Definition: SpellAuraDefines.h:294
@ SPELL_AURA_ADD_TARGET_TRIGGER
Definition: SpellAuraDefines.h:172
#define SUMMON_SLOT_MINIPET
Definition: Unit.h:599
@ SPELL_HACK_AND_SLASH
Definition: Unit.h:292
@ SPELL_SWORD_SPECIALIZATION
Definition: Unit.h:291
@ FORM_MOONKIN
Definition: UnitDefines.h:98
@ FORM_NONE
Definition: UnitDefines.h:69
@ FORM_TREE
Definition: UnitDefines.h:71
@ SPELL_EFFECT_ADD_EXTRA_ATTACKS
Definition: SharedDefines.h:797
@ SPELL_ATTR1_NO_THREAT
Definition: SharedDefines.h:429
@ MECHANIC_FEAR
Definition: SharedDefines.h:1330
@ MECHANIC_SILENCE
Definition: SharedDefines.h:1334
@ AURA_STATE_HEALTHLESS_35_PERCENT
Definition: SharedDefines.h:1305
Creature * GetCreature(WorldObject const &u, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:213
void ModifyThreatByPercent(Unit *victim, int32 percent)
Definition: ThreatMgr.cpp:508
bool HasMechanicTemplateImmunity(uint32 mask) const
Definition: Creature.cpp:2209
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const
Definition: Player.cpp:13427
void RemoveCategoryCooldown(uint32 cat)
Definition: Player.cpp:3510
bool IsClass(Classes playerClass, ClassContext context=CLASS_CONTEXT_NONE) const override
Definition: Player.cpp:1279
Spell const * GetProcSpell() const
Definition: Unit.h:448
Unit * GetActor()
Definition: Unit.h:439
bool HealthAbovePct(int32 pct) const
Definition: Unit.h:788
float GetTotalAttackPowerValue(WeaponAttackType attType, Unit *pVictim=nullptr) const
Definition: Unit.cpp:15355
uint32 GetLastExtraAttackSpell() const
Definition: Unit.h:915
uint32 GetCreateHealth() const
Definition: Unit.h:1382
Unit * GetComboTarget() const
Definition: Unit.h:1635
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:787
uint8 GetRank() const
Definition: SpellInfo.cpp:2493
uint32 ManaCostPercentage
Definition: SpellInfo.h:367
bool HasEffect(SpellEffects effect) const
Definition: SpellInfo.cpp:875
uint32 ManaCost
Definition: SpellInfo.h:363

References Player::AddSpellCooldown(), AddSpellCooldown(), AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, CalculatePct(), CastCustomSpell(), CastDelayedSpellWithPeriodicAmount(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_DEATH_KNIGHT, CLASS_DRUID, CLASS_PALADIN, CLASS_PRIEST, CLASS_SHAMAN, CountPctFromMaxHealth(), EFFECT_0, SpellInfo::Effects, FORM_BEAR, FORM_CAT, FORM_DIREBEAR, FORM_MOONKIN, FORM_NONE, FORM_TREE, ProcEventInfo::GetActor(), SpellInfo::GetAllEffectsMechanicMask(), AuraEffect::GetAmount(), GetAura(), GetAuraEffect(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), Aura::GetCaster(), Aura::GetCastItemGUID(), getClass(), GetComboTarget(), GetCreateHealth(), GetCreateMana(), ObjectAccessor::GetCreature(), AuraEffect::GetEffIndex(), Object::GetEntry(), GetFirstSchoolInMask(), Object::GetFloatValue(), Object::GetGUID(), AuraEffect::GetId(), Player::GetItemByGuid(), GetLastExtraAttackSpell(), SpellInfo::GetMaxDuration(), Player::GetPet(), ProcEventInfo::GetProcSpell(), SpellInfo::GetRank(), SpellInfo::GetSchoolMask(), GetShapeshiftForm(), AuraEffect::GetSpellInfo(), Aura::GetStackAmount(), GetStat(), GetThreatMgr(), GetTotalAttackPowerValue(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), SpellInfo::HasEffect(), Creature::HasMechanicTemplateImmunity(), HasSpellCooldown(), HealthAbovePct(), HealthBelowPct(), HealthBelowPctDamaged(), SpellInfo::Id, IsAlive(), Player::IsBaseRuneSlotsOnCooldown(), Player::IsClass(), IsClass(), Object::IsPlayer(), SpellInfo::IsPositive(), LOG_ERROR, m_SummonSlot, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, SpellInfo::ManaCostPerlevel, MAX_RUNES, MECHANIC_FEAR, MECHANIC_SILENCE, MECHANIC_STUN, ThreatMgr::ModifyThreatByPercent(), POWER_MANA, SpellInfo::PowerType, PROC_EX_CRITICAL_HIT, PROC_EX_NORMAL_HIT, PROC_FLAG_DONE_OFFHAND_ATTACK, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS, PROC_SPELL_PHASE_HIT, RemoveAurasDueToSpell(), Player::RemoveCategoryCooldown(), Player::RemoveSpellCooldown(), roll_chance_i(), RUNE_BLOOD, SPELL_ATTR1_NO_THREAT, SPELL_AURA_ADD_TARGET_TRIGGER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_EFFECT_ADD_EXTRA_ATTACKS, SPELL_HACK_AND_SLASH, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_HOLY, SPELL_SCHOOL_NATURE, SPELL_SCHOOL_NORMAL, SPELL_SCHOOL_SHADOW, SPELL_SWORD_SPECIALIZATION, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sSpellMgr, STAT_AGILITY, STAT_INTELLECT, STAT_SPIRIT, STAT_STRENGTH, SUMMON_SLOT_MINIPET, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MINDAMAGE, and UNIT_FIELD_MINOFFHANDDAMAGE.

Referenced by ProcDamageAndSpellFor().

◆ HandleSafeUnitPointersOnDelete()

void Unit::HandleSafeUnitPointersOnDelete ( Unit thisUnit)
static
4295{
4296 if (thisUnit->SafeUnitPointerSet.empty())
4297 return;
4298 for (std::set<SafeUnitPointer*>::iterator itr = thisUnit->SafeUnitPointerSet.begin(); itr != thisUnit->SafeUnitPointerSet.end(); ++itr)
4299 (*itr)->UnitDeleted();
4300
4301 thisUnit->SafeUnitPointerSet.clear();
4302}

References SafeUnitPointerSet.

Referenced by ~Unit().

◆ HandleSpellClick()

bool Unit::HandleSpellClick ( Unit clicker,
int8  seatId = -1 
)

First check simple relations from clicker to clickee

Check database conditions

19462{
19463 Creature* creature = ToCreature();
19464 if (creature && creature->IsAIEnabled)
19465 {
19466 if (!creature->AI()->BeforeSpellClick(clicker))
19467 {
19468 return false;
19469 }
19470 }
19471
19472 bool result = false;
19473 uint32 spellClickEntry = GetVehicleKit() ? GetVehicleKit()->GetCreatureEntry() : GetEntry();
19474 SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(spellClickEntry);
19475 for (SpellClickInfoContainer::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
19476 {
19478 if (!itr->second.IsFitToRequirements(clicker, this))
19479 continue;
19480
19482 ConditionList conds = sConditionMgr->GetConditionsForSpellClickEvent(spellClickEntry, itr->second.spellId);
19483 ConditionSourceInfo info = ConditionSourceInfo(clicker, this);
19484 if (!sConditionMgr->IsObjectMeetToConditions(info, conds))
19485 continue;
19486
19487 Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
19488 Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
19489 ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
19490
19491 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second.spellId);
19492
19493 // xinef: dont allow players to enter vehicles on arena
19494 if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->IsPlayer() && caster->FindMap() && caster->FindMap()->IsBattleArena())
19495 continue;
19496
19497 if (seatId > -1)
19498 {
19499 uint8 i = 0;
19500 bool valid = false;
19501 while (i < MAX_SPELL_EFFECTS)
19502 {
19503 if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
19504 {
19505 valid = true;
19506 break;
19507 }
19508 ++i;
19509 }
19510
19511 if (!valid)
19512 {
19513 LOG_ERROR("sql.sql", "Spell {} specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId);
19514 continue;
19515 }
19516
19517 if (IsInMap(caster))
19518 caster->CastCustomSpell(itr->second.spellId, SpellValueMod(SPELLVALUE_BASE_POINT0 + i), seatId + 1, target, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
19519 else // This can happen during Player::_LoadAuras
19520 {
19522 for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
19523 bp0[j] = spellInfo->Effects[j].BasePoints;
19524
19525 bp0[i] = seatId;
19526 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
19527 }
19528 }
19529 else
19530 {
19531 if (IsInMap(caster))
19532 caster->CastSpell(target, spellInfo, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
19533 else
19534 Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
19535 }
19536
19537 result = true;
19538 }
19539
19540 if (creature && creature->IsAIEnabled)
19541 creature->AI()->OnSpellClick(clicker, result);
19542
19543 return result;
19544}
SpellValueMod
Definition: SpellDefines.h:113
std::pair< SpellClickInfoContainer::const_iterator, SpellClickInfoContainer::const_iterator > SpellClickInfoMapBounds
Definition: ObjectMgr.h:409
#define sConditionMgr
Definition: ConditionMgr.h:289
std::list< Condition * > ConditionList
Definition: ConditionMgr.h:236
@ NPC_CLICK_CAST_TARGET_CLICKER
Definition: SharedDefines.h:691
@ NPC_CLICK_CAST_ORIG_CASTER_OWNER
Definition: SharedDefines.h:692
@ NPC_CLICK_CAST_CASTER_CLICKER
Definition: SharedDefines.h:690
virtual void OnSpellClick(Unit *, bool &)
Definition: CreatureAI.h:202
virtual bool BeforeSpellClick(Unit *)
Definition: CreatureAI.h:200
Definition: ConditionMgr.h:181
Map * FindMap() const
Definition: Object.h:530
uint32 GetCreatureEntry() const
Definition: Vehicle.h:39
bool IsBattleArena() const
Definition: Map.h:455
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:892

References Creature::AI(), CreatureAI::BeforeSpellClick(), CastCustomSpell(), CastSpell(), SpellInfo::Effects, WorldObject::FindMap(), Vehicle::GetCreatureEntry(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), GetVehicleKit(), SpellInfo::HasAura(), IsAIEnabled, Map::IsBattleArena(), WorldObject::IsInMap(), Object::IsPlayer(), LOG_ERROR, MAX_EFFECT_MASK, MAX_SPELL_EFFECTS, NPC_CLICK_CAST_CASTER_CLICKER, NPC_CLICK_CAST_ORIG_CASTER_OWNER, NPC_CLICK_CAST_TARGET_CLICKER, CreatureAI::OnSpellClick(), sConditionMgr, sObjectMgr, SPELL_AURA_CONTROL_VEHICLE, SPELLVALUE_BASE_POINT0, sSpellMgr, Object::ToCreature(), TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE, TRIGGERED_NONE, and Aura::TryRefreshStackOrCreate().

Referenced by boss_xt002::boss_xt002AI::AttachHeart(), boss_kologarn::boss_kologarnAI::AttachLeftArm(), boss_kologarn::boss_kologarnAI::AttachRightArm(), WorldSession::HandleSpellClick(), Vehicle::InstallAccessory(), and npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI().

◆ HandleStatModifier()

bool Unit::HandleStatModifier ( UnitMods  unitMod,
UnitModifierType  modifierType,
float  amount,
bool  apply 
)
15131{
15132 if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END)
15133 {
15134 LOG_ERROR("entities.unit", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!");
15135 return false;
15136 }
15137
15138 switch (modifierType)
15139 {
15140 case BASE_VALUE:
15141 case TOTAL_VALUE:
15142 m_auraModifiersGroup[unitMod][modifierType] += apply ? amount : -amount;
15143 break;
15144 case BASE_PCT:
15145 case TOTAL_PCT:
15146 ApplyPercentModFloatVar(m_auraModifiersGroup[unitMod][modifierType], amount, apply);
15147 break;
15148 default:
15149 break;
15150 }
15151
15152 if (!CanModifyStats())
15153 return false;
15154
15155 switch (unitMod)
15156 {
15163 break;
15164
15165 case UNIT_MOD_ARMOR:
15166 UpdateArmor();
15167 break;
15168 case UNIT_MOD_HEALTH:
15170 break;
15171
15172 case UNIT_MOD_MANA:
15173 case UNIT_MOD_RAGE:
15174 case UNIT_MOD_FOCUS:
15175 case UNIT_MOD_ENERGY:
15176 case UNIT_MOD_HAPPINESS:
15177 case UNIT_MOD_RUNE:
15180 break;
15181
15189 break;
15190
15193 break;
15196 break;
15197
15200 break;
15203 break;
15206 break;
15207
15208 default:
15209 break;
15210 }
15211
15212 return true;
15213}
@ UNIT_MOD_ARMOR
Definition: Unit.h:156
@ UNIT_MOD_ATTACK_POWER
Definition: Unit.h:163
@ UNIT_MOD_HEALTH
Definition: Unit.h:148
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:167
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:165
@ UNIT_MOD_ATTACK_POWER_RANGED
Definition: Unit.h:164
void apply(T *val)
Definition: ByteConverter.h:40
SpellSchools GetSpellSchoolByAuraGroup(UnitMods unitMod) const
Definition: Unit.cpp:15272
Stats GetStatByAuraGroup(UnitMods unitMod) const
Definition: Unit.cpp:15304
virtual void UpdateAttackPowerAndDamage(bool ranged=false)=0
virtual void UpdateResistances(uint32 school)=0
Powers GetPowerTypeByAuraGroup(UnitMods unitMod) const
Definition: Unit.cpp:15333
virtual void UpdateDamagePhysical(WeaponAttackType attType)
Definition: StatSystem.cpp:60
virtual void UpdateArmor()=0
virtual void UpdateMaxPower(Powers power)=0
virtual bool UpdateStats(Stats stat)=0
bool CanModifyStats() const
Definition: Unit.h:1448
virtual void UpdateMaxHealth()=0

References ApplyPercentModFloatVar(), BASE_ATTACK, BASE_PCT, BASE_VALUE, CanModifyStats(), GetPowerTypeByAuraGroup(), GetSpellSchoolByAuraGroup(), GetStatByAuraGroup(), LOG_ERROR, m_auraModifiersGroup, MODIFIER_TYPE_END, OFF_ATTACK, RANGED_ATTACK, TOTAL_PCT, TOTAL_VALUE, UNIT_MOD_ARMOR, UNIT_MOD_ATTACK_POWER, UNIT_MOD_ATTACK_POWER_RANGED, UNIT_MOD_DAMAGE_MAINHAND, UNIT_MOD_DAMAGE_OFFHAND, UNIT_MOD_DAMAGE_RANGED, UNIT_MOD_END, UNIT_MOD_ENERGY, UNIT_MOD_FOCUS, UNIT_MOD_HAPPINESS, UNIT_MOD_HEALTH, UNIT_MOD_MANA, UNIT_MOD_RAGE, UNIT_MOD_RESISTANCE_ARCANE, UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FROST, UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_NATURE, UNIT_MOD_RESISTANCE_SHADOW, UNIT_MOD_RUNE, UNIT_MOD_RUNIC_POWER, UNIT_MOD_STAT_AGILITY, UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_STAMINA, UNIT_MOD_STAT_STRENGTH, UpdateArmor(), UpdateAttackPowerAndDamage(), UpdateDamagePhysical(), UpdateMaxHealth(), UpdateMaxPower(), UpdateResistances(), and UpdateStats().

Referenced by Player::_ApplyItemBonuses(), Player::_ApplyWeaponDependentAuraDamageMod(), boss_marli::_schedulePhaseSpider(), boss_marli::_schedulePhaseTroll(), Player::ApplyEnchantment(), AuraEffect::HandleAuraIncreaseBaseHealthPercent(), AuraEffect::HandleAuraModAttackPower(), AuraEffect::HandleAuraModAttackPowerPercent(), AuraEffect::HandleAuraModBaseResistancePCT(), AuraEffect::HandleAuraModIncreaseEnergy(), AuraEffect::HandleAuraModIncreaseEnergyPercent(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), AuraEffect::HandleAuraModRangedAttackPower(), AuraEffect::HandleAuraModRangedAttackPowerPercent(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModResistanceExclusive(), AuraEffect::HandleAuraModStat(), AuraEffect::HandleModBaseResistance(), AuraEffect::HandleModDamageDone(), AuraEffect::HandleModDamagePercentDone(), AuraEffect::HandleModOffhandDamagePercent(), AuraEffect::HandleModPercentStat(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), Guardian::InitStatsForLevel(), spell_astromancer_solarian_transform::OnApply(), spell_astromancer_solarian_transform::OnRemove(), boss_arlokk::boss_arlokkAI::Reset(), boss_marli::Reset(), and boss_arlokk::boss_arlokkAI::UpdateAI().

◆ HasActivePowerType()

◆ HasAura()

bool Unit::HasAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
ObjectGuid  itemCasterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0 
) const
5650{
5651 if (GetAuraApplication(spellId, casterGUID, itemCasterGUID, reqEffMask))
5652 return true;
5653 return false;
5654}

References GetAuraApplication().

Referenced by boss_grand_champion::boss_grand_championAI::AddCreatureAddonAuras(), Pet::AddToWorld(), spell_warl_health_funnel::ApplyEffect(), boss_archavon::boss_archavonAI::AttackStart(), boss_emalon::boss_emalonAI::AttackStart(), boss_koralon::boss_koralonAI::AttackStart(), boss_toravon::boss_toravonAI::AttackStart(), boss_hodir::boss_hodirAI::CanAIAttack(), boss_razorgore::boss_razorgoreAI::CanAIAttack(), boss_hazzarah::CanAIAttack(), boss_jindo::CanAIAttack(), boss_renataki::boss_renatakiAI::CanAIAttack(), boss_nethermancer_sepethrea::CanAIAttack(), boss_chromaggus::boss_chromaggusAI::CanAIAttack(), npc_wg_siege_machine::npc_wg_siege_machineAI::CanControlVehicle(), Player::CanJoinToBattleground(), Player::CanResummonPet(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CastItemCombatSpell(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), Spell::CheckCast(), Spell::CheckCasterAuras(), Spell::CheckItems(), spell_pal_hand_of_sacrifice::CheckTarget(), SpellInfo::CheckTarget(), spell_hun_lock_and_load::CheckTrapProc(), npc_mc_core_hound::npc_mc_core_houndAI::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), boss_razorscale::boss_razorscaleAI::DamageTaken(), boss_thekal::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), boss_kalecgos::boss_kalecgosAI::DoAction(), npc_midsummer_ribbon_pole_target::DoCleanupChecks(), Spell::DoCreateItem(), Spell::EffectDummy(), Spell::EffectHeal(), Spell::EffectInstaKill(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSummonPlayer(), Spell::EffectTriggerSpell(), Spell::EffectWeaponDmg(), NPCStaveQuestAI::EvadeOnFeignDeath(), IceTombSummonEvent::Execute(), PartyTimeEmoteEvent::Execute(), spell_class_call_polymorph::FilterTargets(), spell_dru_wild_growth::FilterTargets(), spell_pri_circle_of_healing::FilterTargets(), lfg::LFGMgr::FinishDungeon(), GetDispellableAuraList(), instance_sunwell_plateau::instance_sunwell_plateau_InstanceMapScript::GetPlayerInMap(), Player::GetResurrectionSpellId(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipHello(), go_soulwell::go_soulwellAI::GossipHello(), spell_dk_scourge_strike::HandleAfterHit(), spell_dru_enrage::HandleApply(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraMounted(), Aura::HandleAuraSpecificMods(), WorldSession::HandleBattleFieldPortOpcode(), spell_thaddius_pos_neg_charge::HandleDamage(), spell_capacitus_polarity_charge::HandleDamage(), spell_mage_summon_water_elemental::HandleDummy(), spell_rog_preparation::HandleDummy(), spell_warr_charge::HandleDummy(), HandleDummyAuraProc(), spell_q12851_going_bearback::HandleEffectApply(), spell_dk_improved_blood_presence::HandleEffectApply(), spell_dk_improved_frost_presence::HandleEffectApply(), spell_dk_improved_unholy_presence::HandleEffectApply(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), Player::HandleFall(), gm_commandscript::HandleGMVisibleCommand(), spell_dk_presence::HandleImprovedBloodPresence(), spell_dk_presence::HandleImprovedFrostPresence(), spell_dk_presence::HandleImprovedUnholyPresence(), spell_sindragosa_frost_breath::HandleInfusion(), BattlefieldWG::HandleKill(), lookup_commandscript::HandleLookupSpellCommand(), lookup_commandscript::HandleLookupSpellIdCommand(), WorldSession::HandleMessagechatOpcode(), spell_oculus_soar_aura::HandleOnEffectApply(), spell_mark_of_frost_freeze::HandleOnHit(), OPvPCapturePointZM_GraveYard::HandleOpenGo(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_garr_separation_anxiety_aura::HandlePeriodic(), spell_majordomo_separation_anxiety_aura::HandlePeriodic(), spell_dk_blood_caked_blade::HandleProc(), HandleProcTriggerSpell(), spell_warr_vigilance::HandleRemove(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_pal_lay_on_hands::HandleScript(), spell_hun_pet_heart_of_the_phoenix::HandleScript(), spell_q12611_deathbolt::HandleScriptEffect(), spell_dru_glyph_of_starfire::HandleScriptEffect(), misc_commandscript::HandleUnFreezeCommand(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::InformCloud(), boss_taldaram::InitializeAI(), Player::IsDeserter(), SpellArea::IsFitToRequirements(), npc_anzu_spirit::IsSummonedBy(), go_wg_vehicle_teleporter::go_wg_vehicle_teleporterAI::IsValidVehicle(), IsVampire(), lfg::LFGMgr::JoinLfg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustDied(), boss_professor_putricide::boss_professor_putricideAI::JustDied(), boss_sindragosa::boss_sindragosaAI::JustDied(), boss_hydross_the_unstable::JustDied(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::JustEngagedWith(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::JustEngagedWith(), boss_bjarngrim::boss_bjarngrimAI::JustEngagedWith(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::JustEngagedWith(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::JustEngagedWith(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::JustEngagedWith(), boss_nalorakk::JustEngagedWith(), npc_hivezara_stinger::JustEngagedWith(), boss_vem::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::JustEngagedWith(), boss_hydross_the_unstable::JustEngagedWith(), boss_hydross_the_unstable::JustReachedHome(), Kill(), boss_hydross_the_unstable::KilledUnit(), boss_hadronox::boss_hadronoxAI::KilledUnit(), Creature::LoadCreaturesAddon(), MeleeDamageBonusDone(), ModSpellCastTime(), npc_love_in_air_supply_sentry::MoveInLineOfSight(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::MoveInLineOfSight(), npc_custodian_of_time::npc_custodian_of_timeAI::MoveInLineOfSight(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::MoveInLineOfSight(), npc_guardian_pavilion::npc_guardian_pavilionAI::MoveInLineOfSight(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_daranelle::npc_daranelleAI::MoveInLineOfSight(), boss_lady_vashj::MovementInform(), boss_kagani_nightstrike::MovementInform(), achievement_staying_buffed_all_winter_10::OnCheck(), achievement_staying_buffed_all_winter_25::OnCheck(), achievement_flirt_with_disaster_perf_check::OnCheck(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_pet_gen_argent_pony_bridle::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_aged_dying_ancient_kodo::OnGossipHello(), npc_alchemist_adrianna::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_innkeeper::OnGossipHello(), go_manticron_cube::OnGossipHello(), go_orb_of_domination::OnGossipHello(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_innkeeper::OnGossipSelect(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::OnPlayerAreaUpdate(), instance_scarlet_monastery::instance_scarlet_monastery_InstanceMapScript::OnPlayerEnter(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnPlayerEnter(), spell_azjol_nerub_web_wrap_aura::OnRemove(), spell_icc_web_wrap_aura::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), at_karazhan_atiesh_aran::OnTrigger(), at_hor_battered_hilt_start::OnTrigger(), at_hor_battered_hilt_throw::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), at_commander_dawnforge::OnTrigger(), MidsummerPlayerScript::OnUpdateZone(), Acore::FriendlyMissingBuffInRange::operator()(), NotInStomachSelector::operator()(), SindragosaIceTombCheck::operator()(), NecroticPlagueTargetCheck::operator()(), DefaultTargetSelector::operator()(), LastPhaseIceTombTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), WebTargetSelector::operator()(), ShadowOfDeathSelector::operator()(), Acore::UnitAuraCheck::operator()(), SpectralBlastCheck::operator()(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Player::ReportedAfkBy(), npc_corrupted_totem::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), boss_magus_telestra::boss_magus_telestraAI::Reset(), boss_fathomlord_karathress::Reset(), npc_pet_pri_shadowfiend::Reset(), Player::RewardHonor(), RewardRage(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_jormungarAI::ScheduleEvents(), boss_supremus::SchedulePhase(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), boss_anomalus::boss_anomalusAI::SetData(), npc_thassarian2::npc_thassarian2AI::sGossipHello(), npc_chesspiece::sGossipHello(), npc_omen::npc_omenAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::SpellHit(), npc_greengill_slave::npc_greengill_slaveAI::SpellHit(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::SpellHit(), SpellPctDamageModsDone(), SpellTakenCritChance(), Player::StoreItem(), boss_moam::SummonedCreatureDies(), boss_apothecary_hummel::boss_apothecary_hummelAI::SummonedCreatureDies(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), npc_cyclone::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_moam::UpdateAI(), boss_ossirian::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_beryl_sorcerer::npc_beryl_sorcererAI::UpdateAI(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), Player::UpdateAreaDependentAuras(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI(), boss_netherspite::UpdatePortals(), Player::UpdateZoneDependentAuras(), and Spell::WriteAmmoToPacket().

◆ HasAuraEffect()

bool Unit::HasAuraEffect ( uint32  spellId,
uint8  effIndex,
ObjectGuid  caster = ObjectGuid::Empty 
) const
5620{
5621 AuraApplicationMapBounds range = m_appliedAuras.equal_range(spellId);
5622 for (AuraApplicationMap::const_iterator itr = range.first; itr != range.second; ++itr)
5623 {
5624 if (itr->second->HasEffect(effIndex)
5625 && (!caster || itr->second->GetBase()->GetCasterGUID() == caster))
5626 {
5627 return true;
5628 }
5629 }
5630 return false;
5631}

References m_appliedAuras.

Referenced by Spell::CanAutoCast(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), spell_q12683_take_sputum_sample::HandleDummy(), AchievementCriteriaData::Meets(), and boss_headless_horseman::UpdateAI().

◆ HasAuraState()

bool Unit::HasAuraState ( AuraStateType  flag,
SpellInfo const *  spellProto = nullptr,
Unit const *  Caster = nullptr 
) const
10488{
10489 if (Caster)
10490 {
10491 if (spellProto)
10492 {
10493 AuraEffectList const& stateAuras = Caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
10494 for (AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
10495 if ((*j)->IsAffectedOnSpell(spellProto))
10496 return true;
10497 }
10498 // Check per caster aura state
10499 // If aura with aurastate by caster not found return false
10500 if ((1 << (flag - 1)) & PER_CASTER_AURA_STATE_MASK)
10501 {
10502 AuraStateAurasMapBounds range = m_auraStateAuras.equal_range(flag);
10503 for (AuraStateAurasMap::const_iterator itr = range.first; itr != range.second; ++itr)
10504 if (itr->second->GetBase()->GetCasterGUID() == Caster->GetGUID())
10505 return true;
10506 return false;
10507 }
10508 }
10509
10510 return HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10511}
@ SPELL_AURA_ABILITY_IGNORE_AURASTATE
Definition: SpellAuraDefines.h:325
std::pair< AuraStateAurasMap::const_iterator, AuraStateAurasMap::const_iterator > AuraStateAurasMapBounds
Definition: Unit.h:644

References GetAuraEffectsByType(), Object::GetGUID(), Object::HasFlag(), m_auraStateAuras, PER_CASTER_AURA_STATE_MASK, SPELL_AURA_ABILITY_IGNORE_AURASTATE, and UNIT_FIELD_AURASTATE.

Referenced by Player::_addSpell(), Pet::addSpell(), Spell::CheckCast(), spell_sha_earthliving_weapon::CheckProc(), SpellInfo::CheckTarget(), ClearAllReactives(), Spell::EffectHeal(), Spell::EffectSchoolDMG(), Spell::EffectWeaponDmg(), spell_warr_sweeping_strikes::HandleProc(), HandleProcTriggerSpell(), isFrozen(), Player::LoadFromDB(), MeleeDamageBonusDone(), SpellPctDamageModsDone(), SpellTakenCritChance(), and UpdateReactives().

◆ HasAuraType()

bool Unit::HasAuraType ( AuraType  auraType) const
5657{
5658 return (!m_modAuras[auraType].empty());
5659}

References m_modAuras.

Referenced by ApplyTotalThreatModifier(), Attack(), Creature::CanCreatureAttack(), Player::CanTameExoticPets(), spell_q11010_q11102_q11023_q11008_check_fly_mount::CheckRequirement(), SpellInfo::CheckTarget(), Creature::DoFleeToGetAssistance(), Spell::DoSpellHitOnUnit(), Player::DurabilityPointsLoss(), Spell::EffectStuck(), Spell::EffectWeaponDmg(), npc_wild_wyrm::npc_wild_wyrmAI::EnterEvadeMode(), spell_suppression_aura::FilterTargets(), Player::GetAurasForTarget(), Player::getMaxTimer(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraAllowOnlyAbility(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraEmpathy(), AuraEffect::HandleAuraFeatherFall(), AuraEffect::HandleAuraGhost(), AuraEffect::HandleAuraHover(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModPacifyAndSilence(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModSilence(), AuraEffect::HandleAuraModStalked(), AuraEffect::HandleAuraTrackStealthed(), AuraEffect::HandleAuraUntrackable(), AuraEffect::HandleAuraWaterWalk(), AuraEffect::HandleComprehendLanguage(), AuraEffect::HandleDetectAmore(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), Player::HandleFall(), AuraEffect::HandleForceMoveForward(), WorldSession::HandleMirrorImageDataRequest(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModInvisibilityDetect(), AuraEffect::HandleModStealth(), AuraEffect::HandleModStealthDetect(), AuraEffect::HandleModUnattackable(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandlePreventFleeing(), WorldSession::HandleRepopRequestOpcode(), reset_commandscript::HandleResetStatsOrLevelHelper(), WorldSession::HandleSelfResOpcode(), HasAuraTypeWithFamilyFlags(), HasInvisibilityAura(), HasStealthAura(), isFeared(), SpellArea::IsFitToRequirements(), IsImmunedToDamage(), IsImmunedToSchool(), IsImmunedToSpell(), IsImmunedToSpellEffect(), isInRoots(), isSpellBlocked(), Kill(), Player::KillPlayer(), KnockbackFrom(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), MagicSpellHitResult(), MeleeDamageBonusTaken(), MeleeSpellHitResult(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), LastPhaseIceTombTargetSelector::operator()(), WorldSession::ReadMovementInfo(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), Player::RewardHonor(), RollMeleeOutcomeAgainst(), PetAI::SelectNextTarget(), Player::SendInitialPacketsAfterAddToMap(), SetControlled(), SpellDamageBonusTaken(), SpellTakenCritChance(), Player::Update(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), Creature::UpdateMovementFlags(), and Player::UpdateTriggerVisibility().

◆ HasAuraTypeWithAffectMask()

bool Unit::HasAuraTypeWithAffectMask ( AuraType  auratype,
SpellInfo const *  affectedSpell 
) const
5690{
5691 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5692 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5693 if ((*i)->IsAffectedOnSpell(affectedSpell))
5694 return true;
5695 return false;
5696}

References GetAuraEffectsByType().

Referenced by AuraEffect::CalculatePeriodic(), Spell::DoSpellHitOnUnit(), Spell::handle_immediate(), Aura::RefreshDuration(), and Aura::RefreshTimersWithMods().

◆ HasAuraTypeWithCaster()

bool Unit::HasAuraTypeWithCaster ( AuraType  auratype,
ObjectGuid  caster 
) const
5662{
5663 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5664 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5665 if (caster == (*i)->GetCasterGUID())
5666 return true;
5667 return false;
5668}

References GetAuraEffectsByType().

Referenced by BuildValuesUpdate(), IsAlwaysDetectableFor(), PatchValuesUpdate(), and ThreatContainer::SelectNextVictim().

◆ HasAuraTypeWithFamilyFlags()

bool Unit::HasAuraTypeWithFamilyFlags ( AuraType  auraType,
uint32  familyName,
uint32  familyFlags 
) const
753{
754 if (!HasAuraType(auraType))
755 return false;
756 AuraEffectList const& auras = GetAuraEffectsByType(auraType);
757 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
758 if (SpellInfo const* iterSpellProto = (*itr)->GetSpellInfo())
759 if (iterSpellProto->SpellFamilyName == familyName && iterSpellProto->SpellFamilyFlags[0] & familyFlags)
760 return true;
761 return false;
762}

References GetAuraEffectsByType(), and HasAuraType().

◆ HasAuraTypeWithMiscvalue()

bool Unit::HasAuraTypeWithMiscvalue ( AuraType  auratype,
int32  miscvalue 
) const
5681{
5682 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5683 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5684 if (miscvalue == (*i)->GetMiscValue())
5685 return true;
5686 return false;
5687}

References GetAuraEffectsByType().

Referenced by Player::Regenerate(), Player::UpdateManaRegen(), and Player::UpdateStats().

◆ HasAuraTypeWithTriggerSpell()

bool Unit::HasAuraTypeWithTriggerSpell ( AuraType  auratype,
uint32  triggerSpell 
) const
5708{
5709 for (AuraEffect const* aura : GetAuraEffectsByType(auratype))
5710 {
5711 if (aura->GetSpellInfo()->Effects[aura->GetEffIndex()].TriggerSpell == triggerSpell)
5712 {
5713 return true;
5714 }
5715 }
5716
5717 return false;
5718}

References GetAuraEffectsByType().

Referenced by WorldSession::HandlePetActionHelper().

◆ HasAuraTypeWithValue()

bool Unit::HasAuraTypeWithValue ( AuraType  auratype,
int32  value 
) const
5699{
5700 AuraEffectList const& mTotalAuraList = GetAuraEffectsByType(auratype);
5701 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
5702 if (value == (*i)->GetAmount())
5703 return true;
5704 return false;
5705}

References GetAuraEffectsByType().

◆ HasAuraWithMechanic()

bool Unit::HasAuraWithMechanic ( uint32  mechanicMask) const
5744{
5745 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5746 {
5747 SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo();
5748 if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic)))
5749 return true;
5750
5751 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
5752 if (iter->second->HasEffect(i) && spellInfo->Effects[i].Effect && spellInfo->Effects[i].Mechanic)
5753 if (mechanicMask & (1 << spellInfo->Effects[i].Mechanic))
5754 return true;
5755 }
5756
5757 return false;
5758}

References SpellInfo::Effects, m_appliedAuras, MAX_SPELL_EFFECTS, and SpellInfo::Mechanic.

Referenced by EarthenPowerTargetSelector::operator()(), SpellPctDamageModsDone(), and SpellTakenCritChance().

◆ HasBreakableByDamageAuraType()

bool Unit::HasBreakableByDamageAuraType ( AuraType  type,
uint32  excludeAura = 0 
) const
765{
766 AuraEffectList const& auras = GetAuraEffectsByType(type);
767 for (AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
768 if ((!excludeAura || excludeAura != (*itr)->GetSpellInfo()->Id) && //Avoid self interrupt of channeled Crowd Control spells like Seduction
769 ((*itr)->GetSpellInfo()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_TAKE_DAMAGE))
770 return true;
771 return false;
772}

References AURA_INTERRUPT_FLAG_TAKE_DAMAGE, and GetAuraEffectsByType().

Referenced by HasBreakableByDamageCrowdControlAura().

◆ HasBreakableByDamageCrowdControlAura()

bool Unit::HasBreakableByDamageCrowdControlAura ( Unit excludeCasterChannel = nullptr) const
775{
776 uint32 excludeAura = 0;
777 if (Spell* currentChanneledSpell = excludeCasterChannel ? excludeCasterChannel->GetCurrentSpell(CURRENT_CHANNELED_SPELL) : nullptr)
778 excludeAura = currentChanneledSpell->GetSpellInfo()->Id; //Avoid self interrupt of channeled Crowd Control spells like Seduction
779
785}
@ SPELL_AURA_MOD_FEAR
Definition: SpellAuraDefines.h:70
@ SPELL_AURA_MOD_ROOT
Definition: SpellAuraDefines.h:89
@ SPELL_AURA_TRANSFORM
Definition: SpellAuraDefines.h:119
@ SPELL_AURA_MOD_CONFUSE
Definition: SpellAuraDefines.h:68
@ SPELL_AURA_MOD_STUN
Definition: SpellAuraDefines.h:75
bool HasBreakableByDamageAuraType(AuraType type, uint32 excludeAura=0) const
Definition: Unit.cpp:764
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1404

References CURRENT_CHANNELED_SPELL, GetCurrentSpell(), HasBreakableByDamageAuraType(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, and SPELL_AURA_TRANSFORM.

Referenced by PetAI::CanAttack(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), CasterAI::UpdateAI(), npc_pet_gen_valkyr_guardian::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), and PetAI::UpdateAI().

◆ HasExtraUnitMovementFlag()

uint16 Unit::HasExtraUnitMovementFlag ( uint16  f) const
inline

◆ HasInvisibilityAura()

bool Unit::HasInvisibilityAura ( ) const
inline

◆ HasNegativeAuraWithAttribute()

bool Unit::HasNegativeAuraWithAttribute ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5733{
5734 for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter)
5735 {
5736 Aura const* aura = iter->second->GetBase();
5737 if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid))
5738 return true;
5739 }
5740 return false;
5741}
uint32 Attributes
Definition: SpellInfo.h:324

References SpellInfo::Attributes, Aura::GetCasterGUID(), Aura::GetSpellInfo(), and m_appliedAuras.

◆ HasNegativeAuraWithInterruptFlag()

bool Unit::HasNegativeAuraWithInterruptFlag ( uint32  flag,
ObjectGuid  guid = ObjectGuid::Empty 
)
5721{
5722 if (!(m_interruptMask & flag))
5723 return false;
5724 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter)
5725 {
5726 if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid))
5727 return true;
5728 }
5729 return false;
5730}

References m_interruptableAuras, and m_interruptMask.

Referenced by ThreatContainer::SelectNextVictim().

◆ HasNpcFlag()

bool Unit::HasNpcFlag ( NPCFlags  flags) const
inline

◆ HasSharedVision()

◆ HasSpell()

◆ HasSpellCooldown()

◆ HasSpellItemCooldown()

virtual bool Unit::HasSpellItemCooldown ( uint32  ,
uint32   
) const
inlinevirtual

Reimplemented in Player.

1762{ return false; }

Referenced by Spell::CheckCast(), and ProcDamageAndSpellFor().

◆ HasStealthAura()

◆ HasUnitFlag()

bool Unit::HasUnitFlag ( UnitFlags  flags) const
inline
825{ return HasFlag(UNIT_FIELD_FLAGS, flags); }

References Object::HasFlag(), and UNIT_FIELD_FLAGS.

Referenced by _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), Vehicle::AddPassenger(), AttackerStateUpdate(), boss_malygos::boss_malygosAI::AttackStart(), SmartAI::AttackStart(), npc_halazzi_lynx::AttackStart(), npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), violet_hold_trashAI::AttackStart(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::AttackStart(), npc_ravenous_worg::npc_ravenous_worgAI::AttackStart(), npc_swarm_scarab::npc_swarm_scarabAI::CanAIAttack(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanNoReagentCast(), CanSwim(), CanUseAttackType(), Spell::CheckEffectTarget(), boss_muru::boss_muruAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_jormungarAI::DoAction(), Spell::DoSpellHitOnUnit(), RandomMovementGenerator< T >::DoUpdate(), boss_dorothee::EnterEvadeMode(), boss_roar::EnterEvadeMode(), boss_strawman::EnterEvadeMode(), boss_tinhead::EnterEvadeMode(), boss_julianne::EnterEvadeMode(), SmartAI::EnterEvadeMode(), GetReactionTo(), GetVelocity(), spell_gen_model_visible::HandleEffectApply(), WorldSession::HandleMovementOpcodes(), spell_gen_mounted_charge::HandleScriptEffect(), IsImmuneToNPC(), IsImmuneToPC(), IsInCombat(), IsMounted(), IsPetInCombat(), isTargetableForAttack(), violet_hold_trashAI::JustEngagedWith(), boss_novos::boss_novosAI::JustSummoned(), Condition::Meets(), MotionMaster::MoveCharge(), MotionMaster::MoveChase(), MotionMaster::MoveConfused(), MotionMaster::MoveDistract(), MotionMaster::MoveFall(), MotionMaster::MoveFleeing(), MotionMaster::MoveFollow(), boss_professor_putricide::boss_professor_putricideAI::MoveInLineOfSight(), boss_palehoof::boss_palehoofAI::MoveInLineOfSight(), npc_massive_jormungar::npc_massive_jormungarAI::MoveInLineOfSight(), npc_ferocious_rhino::npc_ferocious_rhinoAI::MoveInLineOfSight(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::MoveInLineOfSight(), npc_frenzied_worgen::npc_frenzied_worgenAI::MoveInLineOfSight(), npc_shattered_hand_scout::MoveInLineOfSight(), npc_nether_drake::npc_nether_drakeAI::MoveInLineOfSight(), MotionMaster::MoveLand(), MotionMaster::MovePath(), MotionMaster::MovePoint(), MotionMaster::MoveRandom(), MotionMaster::MoveSeekAssistance(), MotionMaster::MoveSeekAssistanceDistract(), MotionMaster::MoveSplinePath(), MotionMaster::MoveTakeoff(), MotionMaster::MoveTargetedHome(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_pet_warlock::npc_toc_pet_warlockAI::myCanCast(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), Creature::RefreshSwimmingFlag(), ScriptedAI::SelectSpell(), Player::SetClientControl(), SetSpeed(), boss_the_lurker_below::SummonedCreatureDies(), Player::Update(), npc_onyxian_lair_guard::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_toc_warrior::npc_toc_warriorAI::UpdateAI(), npc_toc_dk::npc_toc_dkAI::UpdateAI(), npc_toc_rogue::npc_toc_rogueAI::UpdateAI(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::UpdateAI(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), npc_power_spark::npc_power_sparkAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), npc_xt002_heart::npc_xt002_heartAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), npc_ravenous_worg::npc_ravenous_worgAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), and Player::UpdateTriggerVisibility().

◆ HasUnitFlag2()

◆ HasUnitMovementFlag()

◆ HasUnitState()

bool Unit::HasUnitState ( const uint32  f) const
inline
739{ return (m_state & f); }

References m_state.

Referenced by Spell::_cast(), Creature::_IsTargetAcceptable(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), AddThreat(), Attack(), AttackerStateUpdate(), FollowerAI::AttackStart(), npc_raging_spirit::npc_raging_spiritAI::AttackStart(), boss_alar::boss_alar(), boss_anetheron::boss_anetheron(), boss_anzu::boss_anzu(), boss_apothecary_hummel::boss_apothecary_hummelAI::boss_apothecary_hummelAI(), boss_archimonde::boss_archimonde(), boss_azgalor::boss_azgalor(), boss_azuregos::boss_azuregosAI::boss_azuregosAI(), boss_balinda::boss_balinda(), boss_bigbadwolf::boss_bigbadwolf(), boss_blackheart_the_inciter::boss_blackheart_the_inciter(), boss_blindeye_the_seer::boss_blindeye_the_seer(), boss_captain_skarloc::boss_captain_skarloc(), boss_curator::boss_curator(), boss_darkweaver_syth::boss_darkweaver_syth(), boss_dorothee::boss_dorothee(), boss_exarch_maladaar::boss_exarch_maladaar(), boss_fathomguard_caribdis::boss_fathomguard_caribdis(), boss_fathomguard_sharkkis::boss_fathomguard_sharkkis(), boss_fathomguard_tidalvess::boss_fathomguard_tidalvess(), boss_ghazan::boss_ghazan(), boss_grand_warlock_nethekurse::boss_grand_warlock_nethekurse(), boss_halazzi::boss_halazzi(), boss_high_astromancer_solarian::boss_high_astromancer_solarian(), boss_high_king_maulgar::boss_high_king_maulgar(), boss_jarien::boss_jarien(), boss_kazrogal::boss_kazrogal(), boss_kelidan_the_breaker::boss_kelidan_the_breaker(), boss_kiggler_the_crazed::boss_kiggler_the_crazed(), boss_krosh_firehand::boss_krosh_firehand(), boss_lady_vashj::boss_lady_vashj(), boss_magtheridon::boss_magtheridon(), boss_maiden_of_virtue::boss_maiden_of_virtue(), boss_mekgineer_steamrigger::boss_mekgineer_steamrigger(), boss_mennu_the_betrayer::boss_mennu_the_betrayer(), boss_mor_grayhoof::boss_mor_grayhoof(), boss_moroes::boss_moroes(), boss_morogrim_tidewalker::boss_morogrim_tidewalker(), boss_murmur::boss_murmur(), boss_nazan::boss_nazan(), boss_nexusprince_shaffar::boss_nexusprince_shaffar(), boss_olm_the_summoner::boss_olm_the_summoner(), boss_omor_the_unscarred::boss_omor_the_unscarred(), boss_pandemonius::boss_pandemonius(), boss_quagmirran::boss_quagmirran(), boss_rage_winterchill::boss_rage_winterchill(), boss_roar::boss_roar(), boss_rokmar_the_crackler::boss_rokmar_the_crackler(), boss_shirrak_the_dead_watcher::boss_shirrak_the_dead_watcher(), boss_sothos::boss_sothos(), boss_strawman::boss_strawman(), boss_supremus::boss_supremus(), boss_swamplord_muselek::boss_swamplord_muselek(), boss_talon_king_ikiss::boss_talon_king_ikiss(), boss_tavarok::boss_tavarok(), boss_terestian_illhoof::boss_terestian_illhoof(), boss_the_black_stalker::boss_the_black_stalker(), boss_the_maker::boss_the_maker(), boss_tinhead::boss_tinhead(), boss_vazruden::boss_vazruden(), boss_void_reaver::boss_void_reaver(), boss_warbringer_omrogg::boss_warbringer_omrogg(), boss_warchief_kargath_bladefist::boss_warchief_kargath_bladefist(), boss_watchkeeper_gargolmar::boss_watchkeeper_gargolmar(), BossAI::BossAI(), PathGenerator::CalculatePath(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::CanAIAttack(), PetAI::CanAttack(), Player::CanEquipItem(), CanFreeMove(), Creature::CanPeriodicallyCallForAssistance(), Creature::CanStartAttack(), spell_dk_death_grip::CheckCast(), Spell::CheckCast(), Spell::CheckPetCast(), spell_warr_retaliation::CheckProc(), CreatureUnitRelocationWorker(), boss_garfrost::boss_garfrostAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), DealDamage(), DealMeleeDamage(), DisableRotate(), UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), UnitAI::DoSpellAttackIfReady(), UnitAI::DoSpellAttackToRandomTargetIfReady(), Spell::DoSpellHitOnUnit(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), Spell::EffectDistract(), Spell::EffectKnockBack(), CritterAI::EnterEvadeMode(), SmartAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Spell::finish(), Player::GetInitialVisiblePackets(), WorldSession::HandleAuctionListItems(), spell_dru_starfall_dummy::HandleDummy(), WorldSession::HandleEmoteOpcode(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleMoveTeleportAck(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandlePlayerLoginFromDB(), WorldSession::HandlePlayerLoginToCharInWorld(), AuraEffect::HandleProcTriggerDamageAuraProc(), ArenaSpectator::HandleSpectatorSpectateCommand(), boss_venoxis::InitializeAI(), isAttackingPlayer(), boss_faction_championsAI::IsCCed(), Creature::IsInEvadeMode(), IsInFlight(), IsMovementPreventedByCasting(), Creature::IsMovementPreventedByCasting(), isPossessed(), isPossessedByPlayer(), isSpellBlocked(), IsStopped(), isTargetableForAttack(), IsValidCombatTarget(), CritterAI::JustEngagedWith(), npc_coren_direbrew_sisters::JustEngagedWith(), boss_yoggsaron_keeper::JustEngagedWith(), boss_essence_of_desire::boss_essence_of_desireAI::JustEngagedWith(), PetAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), LoadHelper(), MagicSpellHitResult(), MeleeSpellHitResult(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), SmartAI::MoveInLineOfSight(), npc_toc_druid::npc_toc_druidAI::myCanCast(), npc_toc_shaman::npc_toc_shamanAI::myCanCast(), npc_toc_paladin::npc_toc_paladinAI::myCanCast(), npc_toc_priest::npc_toc_priestAI::myCanCast(), npc_toc_shadow_priest::npc_toc_shadow_priestAI::myCanCast(), npc_toc_warlock::npc_toc_warlockAI::myCanCast(), npc_toc_mage::npc_toc_mageAI::myCanCast(), npc_toc_hunter::npc_toc_hunterAI::myCanCast(), npc_toc_boomkin::npc_toc_boomkinAI::myCanCast(), npc_toc_warrior::npc_toc_warriorAI::myCanCast(), npc_toc_dk::npc_toc_dkAI::myCanCast(), npc_toc_rogue::npc_toc_rogueAI::myCanCast(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::myCanCast(), npc_toc_retro_paladin::npc_toc_retro_paladinAI::myCanCast(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), npc_apothecary_baxter::npc_apothecary_baxter(), npc_batrider::npc_batrider(), npc_capernian::npc_capernian(), npc_hyjal_frost_wyrm::npc_hyjal_frost_wyrm(), npc_hyjal_gargoyle::npc_hyjal_gargoyle(), npc_hyjal_ground_trash::npc_hyjal_ground_trash(), npc_icc_spire_frostwyrm::npc_icc_spire_frostwyrm(), npc_inner_demon::npc_inner_demon(), npc_lord_sanguinar::npc_lord_sanguinar(), npc_telonicus::npc_telonicus(), npc_thaladred::npc_thaladred(), Acore::FriendlyCCedInRange::operator()(), SmartScript::ProcessAction(), RemoveCharmedBy(), boss_kormok::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), npc_ohgan::npc_ohganAI::Reset(), boss_thekal::Reset(), npc_zealot_lorkhan::Reset(), npc_zealot_zath::Reset(), boss_isalien::Reset(), npc_anubisath_guardian::Reset(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::Reset(), npc_ashtongue_channeler::Reset(), RollMeleeOutcomeAgainst(), boss_faction_championsAI::SelectEnemyCaster(), Player::SetClientControl(), SetContestedPvP(), SetControlled(), Creature::SetDisableGravity(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), Creature::SetHover(), SetInCombatState(), SetInFront(), SetRooted(), SetStunned(), WaypointMovementGenerator< Creature >::StartMove(), lfg::LFGMgr::TeleportPlayer(), CreatureAI::TriggerAlert(), Player::Update(), Update(), TimedFleeingMovementGenerator::Update(), boss_sartharion_dragonAI::UpdateAI(), CombatAI::UpdateAI(), CasterAI::UpdateAI(), BossAI::UpdateAI(), WorldBossAI::UpdateAI(), npc_av_marshal_or_warmaster::npc_av_marshal_or_warmasterAI::UpdateAI(), ironhand_guardian::ironhand_guardianAI::UpdateAI(), boss_anubshiah::boss_anubshiahAI::UpdateAI(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::UpdateAI(), boss_eviscerator::boss_evisceratorAI::UpdateAI(), boss_gorosh_the_dervish::boss_gorosh_the_dervishAI::UpdateAI(), boss_grizzle::boss_grizzleAI::UpdateAI(), boss_hedrum::boss_hedrumAI::UpdateAI(), boss_moira_bronzebeardAI::UpdateAI(), boss_high_priestess_thaurissanAI::UpdateAI(), boss_okthor::boss_okthorAI::UpdateAI(), boss_drakkisath::boss_drakkisathAI::UpdateAI(), boss_halycon::boss_halyconAI::UpdateAI(), boss_highlord_omokk::boss_highlordomokkAI::UpdateAI(), boss_lord_valthalak::boss_lord_valthalakAI::UpdateAI(), boss_overlord_wyrmthalak::boss_overlordwyrmthalakAI::UpdateAI(), boss_quartermaster_zigris::UpdateAI(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_solakar_flamewreath::boss_solakar_flamewreathAI::UpdateAI(), boss_the_beast::boss_thebeastAI::UpdateAI(), boss_urok_doomhowl::boss_urok_doomhowlAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_chromaggus::boss_chromaggusAI::UpdateAI(), boss_ebonroc::boss_ebonrocAI::UpdateAI(), boss_firemaw::boss_firemawAI::UpdateAI(), boss_flamegor::boss_flamegorAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_nefarian::UpdateAI(), boss_razorgore::boss_razorgoreAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_garr::boss_garrAI::UpdateAI(), boss_golemagg::boss_golemaggAI::UpdateAI(), npc_core_rager::npc_core_ragerAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_flamewaker_priest::npc_flamewaker_priestAI::UpdateAI(), npc_mc_core_hound::npc_mc_core_houndAI::UpdateAI(), boss_netherspite::UpdateAI(), boss_servant_quarters::UpdateAI(), npc_kilrek::UpdateAI(), boss_felblood_kaelthas::UpdateAI(), boss_priestess_delrissa::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), boss_kagani_nightstrike::UpdateAI(), boss_selin_fireheart::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_brutallus::boss_brutallusAI::UpdateAI(), boss_sacrolash::boss_sacrolashAI::UpdateAI(), boss_alythess::boss_alythessAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_muru::boss_muruAI::UpdateAI(), boss_entropius::boss_entropiusAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_jaina_proudmoore_bfu::npc_jaina_proudmoore_bfuAI::UpdateAI(), boss_blight_worm::boss_blight_wormAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_gahzranka::boss_gahzrankaAI::UpdateAI(), boss_grilek::boss_grilekAI::UpdateAI(), boss_hakkar::boss_hakkarAI::UpdateAI(), boss_hazzarah::UpdateAI(), boss_jindo::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_wushoolay::boss_wushoolayAI::UpdateAI(), npc_coren_direbrew::UpdateAI(), npc_hallows_end_soh::UpdateAI(), boss_headless_horseman::UpdateAI(), boss_epoch::boss_epochAI::UpdateAI(), boss_infinite_corruptor::boss_infinite_corruptorAI::UpdateAI(), boss_mal_ganis::boss_mal_ganisAI::UpdateAI(), boss_meathook::boss_meathookAI::UpdateAI(), boss_salramm::boss_salrammAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), boss_lieutenant_drake::UpdateAI(), boss_onyxia::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), npc_belnistrasz::npc_belnistraszAI::UpdateAI(), npc_shadowpriest_sezziz::npc_shadowpriest_sezzizAI::UpdateAI(), boss_elder_nadox::UpdateAI(), boss_volazj::UpdateAI(), boss_jedoga_shadowseeker::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_hadronox::boss_hadronoxAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_krik_thir::boss_krik_thirAI::UpdateAI(), boss_sartharion::boss_sartharionAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), npc_baltharus_the_warborn_clone::npc_baltharus_the_warborn_cloneAI::UpdateAI(), boss_general_zarithrian::boss_general_zarithrianAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_saviana_ragefire::boss_saviana_ragefireAI::UpdateAI(), boss_eadric::boss_eadricAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), npc_argent_soldier::npc_argent_soldierAI::UpdateAI(), boss_black_knight::boss_black_knightAI::UpdateAI(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::UpdateAI(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_toc_hunter::npc_toc_hunterAI::UpdateAI(), boss_jaraxxus::boss_jaraxxusAI::UpdateAI(), npc_fel_infernal::npc_fel_infernalAI::UpdateAI(), npc_mistress_of_pain::npc_mistress_of_painAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_twin_valkyrAI::UpdateAI(), boss_dred::boss_dredAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), boss_trollgore::boss_trollgoreAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_fos_corrupted_soul_fragment::npc_fos_corrupted_soul_fragmentAI::UpdateAI(), boss_devourer_of_souls::boss_devourer_of_soulsAI::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_ghostly_priest::npc_ghostly_priestAI::UpdateAI(), npc_phantom_mage::npc_phantom_mageAI::UpdateAI(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::UpdateAI(), npc_spectral_footman::npc_spectral_footmanAI::UpdateAI(), npc_tortured_rifleman::npc_tortured_riflemanAI::UpdateAI(), boss_frostsworn_general::boss_frostsworn_generalAI::UpdateAI(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::UpdateAI(), npc_hor_risen_witch_doctor::npc_hor_risen_witch_doctorAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_gal_darah::boss_gal_darahAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::UpdateAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::UpdateAI(), boss_festergut::boss_festergutAI::UpdateAI(), npc_stinky_icc::npc_stinky_iccAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_leader::npc_gunship_boarding_leaderAI::UpdateAI(), npc_gunship_boarding_add::npc_gunship_boarding_add_realAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_precious_icc::npc_precious_iccAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_spinestalker::npc_spinestalkerAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), npc_gluttonous_abomination::npc_gluttonous_abominationAI::UpdateAI(), npc_rotting_frost_giant::npc_rotting_frost_giantAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_sister_svalna::boss_sister_svalnaAI::UpdateAI(), npc_captain_arnath::npc_captain_arnathAI::UpdateAI(), npc_captain_brandon::npc_captain_brandonAI::UpdateAI(), npc_captain_grondel::npc_captain_grondelAI::UpdateAI(), npc_captain_rupert::npc_captain_rupertAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), npc_icc_skybreaker_hierophant::npc_icc_skybreaker_hierophantAI::UpdateAI(), npc_icc_skybreaker_marksman::npc_icc_skybreaker_marksmanAI::UpdateAI(), npc_icc_skybreaker_vicar::npc_icc_skybreaker_vicarAI::UpdateAI(), npc_icc_skybreaker_luminary::npc_icc_skybreaker_luminaryAI::UpdateAI(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::UpdateAI(), npc_icc_severed_essence::npc_icc_severed_essenceAI::UpdateAI(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::UpdateAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::UpdateAI(), boss_isle_of_conquest::boss_isle_of_conquestAI::UpdateAI(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_loatheb::boss_loathebAI::UpdateAI(), boss_maexxna::boss_maexxnaAI::UpdateAI(), boss_noth::boss_nothAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_razuvious_minion::boss_razuvious_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_nexus_lord::npc_nexus_lordAI::UpdateAI(), npc_scion_of_eternity::npc_scion_of_eternityAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_ormorok::boss_ormorokAI::UpdateAI(), boss_drakos::boss_drakosAI::UpdateAI(), boss_eregos::boss_eregosAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_volkhan::boss_volkhanAI::UpdateAI(), npc_molten_golem::npc_molten_golemAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_krystallus::boss_krystallusAI::UpdateAI(), boss_maiden_of_grief::boss_maiden_of_griefAI::UpdateAI(), boss_sjonnir::boss_sjonnirAI::UpdateAI(), boss_sjonnir_iron_sludge::boss_sjonnir_iron_sludgeAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_steelbreaker::boss_steelbreakerAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_auriaya::boss_auriayaAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_stonebark::boss_freya_elder_stonebarkAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), boss_freya_elder_ironbranch::boss_freya_elder_ironbranchAI::UpdateAI(), boss_freya_summons::boss_freya_summonsAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), npc_ulduar_hodir_priest::npc_ulduar_hodir_priestAI::UpdateAI(), npc_ulduar_hodir_druid::npc_ulduar_hodir_druidAI::UpdateAI(), npc_ulduar_hodir_shaman::npc_ulduar_hodir_shamanAI::UpdateAI(), npc_ulduar_hodir_mage::npc_ulduar_hodir_mageAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_thorim::boss_thorimAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::UpdateAI(), boss_thorim_gauntlet_npcs::boss_thorim_gauntlet_npcsAI::UpdateAI(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::UpdateAI(), boss_thorim_ancient_rune_giant::boss_thorim_ancient_rune_giantAI::UpdateAI(), boss_thorim_arena_npcs::boss_thorim_arena_npcsAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_yoggsaron::boss_yoggsaronAI::UpdateAI(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_ulduar_storm_tempered_keeper::npc_ulduar_storm_tempered_keeperAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_keleseth::boss_kelesethAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), boss_dalronn_the_controller::boss_dalronn_the_controllerAI::UpdateAI(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::UpdateAI(), npc_massive_jormungar::npc_massive_jormungarAI::UpdateAI(), npc_ferocious_rhino::npc_ferocious_rhinoAI::UpdateAI(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::UpdateAI(), npc_frenzied_worgen::npc_frenzied_worgenAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), boss_archavon::boss_archavonAI::UpdateAI(), boss_emalon::boss_emalonAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), boss_toravon::boss_toravonAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_erekem_guard::npc_erekem_guardAI::UpdateAI(), boss_lavanthor::boss_lavanthorAI::UpdateAI(), boss_moragg::boss_moraggAI::UpdateAI(), boss_xevozz::boss_xevozzAI::UpdateAI(), boss_zuramat::boss_zuramatAI::UpdateAI(), npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_exarch_maladaar::UpdateAI(), boss_nexusprince_shaffar::UpdateAI(), npc_yor::UpdateAI(), boss_anzu::UpdateAI(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_gathios_the_shatterer::UpdateAI(), boss_high_nethermancer_zerevor::UpdateAI(), boss_lady_malande::UpdateAI(), boss_veras_darkshadow::UpdateAI(), boss_essence_of_suffering::boss_essence_of_sufferingAI::UpdateAI(), boss_essence_of_desire::boss_essence_of_desireAI::UpdateAI(), boss_essence_of_anger::boss_essence_of_angerAI::UpdateAI(), boss_doomlord_kazzak::boss_doomlordkazzakAI::UpdateAI(), boss_doomwalker::UpdateAI(), boss_leotheras_the_blind::UpdateAI(), boss_gruul::UpdateAI(), boss_the_maker::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), boss_watchkeeper_gargolmar::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_lord_sanguinar::UpdateAI(), npc_capernian::UpdateAI(), npc_telonicus::UpdateAI(), npc_maghar_captive::npc_maghar_captiveAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::UpdateAI(), npc_pet_gen_target_following_bomb::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), emerald_dragonAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), PetAI::UpdateAI(), npc_orb_carrier::npc_orb_carrierAI::UpdateAI(), npc_hor_raging_ghoul::npc_hor_raging_ghoulAI::UpdateAI(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::UpdateAI(), npc_wg_spirit_guide::npc_wg_spirit_guideAI::UpdateAI(), Player::UpdateCharmedAI(), npc_general_andorov::UpdateEscortAI(), npc_onyx_flamecaller::npc_onyx_flamecallerAI::UpdateEscortAI(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), npc_kurenai_captive::npc_kurenai_captiveAI::UpdateEscortAI(), npc_isla_starmane::npc_isla_starmaneAI::UpdateEscortAI(), SmartAI::UpdatePath(), and SmartScript::UpdateTimer().

◆ HasUnitTypeMask()

◆ HasVisibleAuraType()

bool Unit::HasVisibleAuraType ( AuraType  auraType) const
5671{
5672 AuraEffectList const& mAuraList = GetAuraEffectsByType(auraType);
5673 for (AuraEffectList::const_iterator i = mAuraList.begin(); i != mAuraList.end(); ++i)
5674 if( (*i)->GetBase()->CanBeSentToClient() )
5675 return true;
5676
5677 return false;
5678}

References GetAuraEffectsByType().

◆ haveOffhandWeapon()

◆ HealBySpell()

int32 Unit::HealBySpell ( HealInfo healInfo,
bool  critical = false 
)
11180{
11181 uint32 heal = healInfo.GetHeal();
11182 sScriptMgr->ModifyHealReceived(this, healInfo.GetTarget(), heal, healInfo.GetSpellInfo());
11183 healInfo.SetHeal(heal);
11184
11185 // calculate heal absorb and reduce healing
11186 CalcHealAbsorb(healInfo);
11187
11188 int32 gain = Unit::DealHeal(healInfo.GetHealer(), healInfo.GetTarget(), healInfo.GetHeal());
11189 healInfo.SetEffectiveHeal(gain);
11190
11191 SendHealSpellLog(healInfo, critical);
11192 return gain;
11193}
Unit * GetHealer() const
Definition: Unit.h:410
void SetHeal(uint32 amount)
Definition: Unit.h:400
void SetEffectiveHeal(uint32 amount)
Definition: Unit.h:405
static void CalcHealAbsorb(HealInfo &healInfo)
Definition: Unit.cpp:2469
static int32 DealHeal(Unit *healer, Unit *victim, uint32 addhealth)
Definition: Unit.cpp:10886
void SendHealSpellLog(HealInfo const &healInfo, bool critical=false)
Definition: Unit.cpp:11162

References CalcHealAbsorb(), DealHeal(), HealInfo::GetHeal(), HealInfo::GetHealer(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SendHealSpellLog(), HealInfo::SetEffectiveHeal(), HealInfo::SetHeal(), and sScriptMgr.

Referenced by Spell::DoAllEffectOnTarget(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ HealthAbovePct()

◆ HealthAbovePctHealed()

bool Unit::HealthAbovePctHealed ( int32  pct,
uint32  heal 
) const
inline

◆ HealthBelowPct()

bool Unit::HealthBelowPct ( int32  pct) const
inline
786{ return GetHealth() < CountPctFromMaxHealth(pct); }

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_moira_bronzebeardAI::CastOnEmperorIfPossible(), boss_mor_grayhoof::DamageTaken(), boss_isalien::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::DamageTaken(), boss_hadronox::boss_hadronoxAI::DamageTaken(), HandleDummyAuraProc(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), HandleProcTriggerSpell(), ScriptedAI::HealthBelowPct(), boss_olm_the_summoner::JustEngagedWith(), boss_grand_warlock_nethekurse::JustEngagedWith(), Player::LoadFromDB(), npc_death_knight_initiate::OnGossipHello(), SetHealth(), SpellPctHealingModsDone(), Update(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_priestess_lackey_commonAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kalec::boss_kalecAI::UpdateAI(), boss_sathrovarr::boss_sathrovarrAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_sentinel_leader::UpdateAI(), npc_sentinel_infiltrator::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::UpdateAI(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), boss_twilight_halion::boss_twilight_halionAI::UpdateAI(), boss_tharon_ja::boss_tharon_jaAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_drakkari_elemental::boss_drakkari_elementalAI::UpdateAI(), boss_eck::boss_eckAI::UpdateAI(), boss_slad_ran::boss_slad_ranAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_anomalus::boss_anomalusAI::UpdateAI(), boss_keristrasza::boss_keristraszaAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_ormorok::boss_ormorokAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_grand_warlock_nethekurse::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateEscortAI(), and npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI().

◆ HealthBelowPctDamaged()

bool Unit::HealthBelowPctDamaged ( int32  pct,
uint32  damage 
) const
inline
787{ return int64(GetHealth()) - int64(damage) < int64(CountPctFromMaxHealth(pct)); }
std::int64_t int64
Definition: Define.h:102

References CountPctFromMaxHealth(), and GetHealth().

Referenced by boss_mandokir::boss_mandokirAI::DamageDealt(), boss_gyth::boss_gythAI::DamageTaken(), boss_lord_valthalak::boss_lord_valthalakAI::DamageTaken(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::DamageTaken(), boss_quartermaster_zigris::DamageTaken(), boss_warmaster_voone::boss_warmastervooneAI::DamageTaken(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_golemagg::boss_golemaggAI::DamageTaken(), npc_core_rager::npc_core_ragerAI::DamageTaken(), boss_attumen::DamageTaken(), boss_midnight::DamageTaken(), boss_kormok::DamageTaken(), npc_batrider::DamageTaken(), npc_coren_direbrew::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_onyxia::DamageTaken(), npc_anubisath_guardian::DamageTaken(), boss_ouro::DamageTaken(), npc_anubisath_sentinel::aqsentinelAI::DamageTaken(), npc_anubisath_defender::DamageTaken(), boss_elder_nadox::DamageTaken(), boss_volazj::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_sartharion::boss_sartharionAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_gunship::npc_gunshipAI::DamageTaken(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::DamageTaken(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::DamageTaken(), npc_gunship_boarding_addAI::DamageTaken(), npc_shambling_horror_icc::npc_shambling_horror_iccAI::DamageTaken(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::DamageTaken(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::DamageTaken(), boss_malygos::boss_malygosAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), npc_xt002_boombot::npc_xt002_boombotAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_akama_shade::DamageTaken(), boss_vazruden::DamageTaken(), npc_millhouse_manastorm::npc_millhouse_manastormAI::DamageTaken(), npc_magister_aledis::DamageTaken(), BossAI::DamageTaken(), boss_buru::DamageTaken(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DamageTaken(), boss_bug_trio::DamageTaken(), boss_hadronox::boss_hadronoxAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), and HandleProcTriggerSpell().

◆ IncrDiminishing()

void Unit::IncrDiminishing ( DiminishingGroup  group)
14961{
14962 // Checking for existing in the table
14963 for (Diminishing::iterator i = m_Diminishing.begin(); i != m_Diminishing.end(); ++i)
14964 {
14965 if (i->DRGroup != group)
14966 continue;
14967 if (int32(i->hitCount) < GetDiminishingReturnsMaxLevel(group))
14968 i->hitCount += 1;
14969 return;
14970 }
14972}
DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group)
Definition: SpellMgr.cpp:265
Definition: Unit.h:272

References DIMINISHING_LEVEL_2, GetDiminishingReturnsMaxLevel(), GameTime::GetGameTimeMS(), and m_Diminishing.

Referenced by Spell::DoSpellHitOnUnit().

◆ InitCharmInfo()

CharmInfo * Unit::InitCharmInfo ( )
15740{
15741 if (!m_charmInfo)
15742 m_charmInfo = new CharmInfo(this);
15743
15744 return m_charmInfo;
15745}
Definition: CharmInfo.h:125

References m_charmInfo.

Referenced by Guardian::Guardian(), Pet::Pet(), and SetCharmedBy().

◆ InitStatBuffMods()

void Unit::InitStatBuffMods ( )
inline
1373 {
1374 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_POSSTAT0) + i, 0);
1375 for (uint8 i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(static_cast<uint16>(UNIT_FIELD_NEGSTAT0) + i, 0);
1376 }

References STAT_STRENGTH, UNIT_FIELD_NEGSTAT0, and UNIT_FIELD_POSSTAT0.

Referenced by Player::InitStatsForLevel().

◆ InitTamedPet()

bool Unit::InitTamedPet ( Pet pet,
uint8  level,
uint32  spell_id 
)
17313{
17314 Player* player = ToPlayer();
17315 PetStable& petStable = player->GetOrInitPetStable();
17316 if (petStable.CurrentPet || petStable.GetUnslottedHunterPet())
17317 return false;
17318
17319 pet->SetCreatorGUID(GetGUID());
17320 pet->SetFaction(GetFaction());
17321 pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
17322
17323 if (IsPlayer())
17325
17326 if (!pet->InitStatsForLevel(level))
17327 {
17328 LOG_ERROR("entities.unit", "Pet::InitStatsForLevel() failed for creature (Entry: {})!", pet->GetEntry());
17329 return false;
17330 }
17331
17332 pet->GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
17333 // this enables pet details window (Shift+P)
17334 pet->InitPetCreateSpells();
17335 pet->SetFullHealth();
17336 pet->FillPetInfo(&petStable.CurrentPet.emplace());
17337 return true;
17338}
@ UNIT_CREATED_BY_SPELL
Definition: UpdateFields.h:138
bool InitStatsForLevel(uint8 level)
Definition: Pet.cpp:1021
void FillPetInfo(PetStable::PetInfo *petInfo) const
Definition: Pet.cpp:2474
void InitPetCreateSpells()
Definition: Pet.cpp:2049
Definition: PetDefines.h:202
PetInfo const * GetUnslottedHunterPet() const
Definition: PetDefines.h:230
Optional< PetInfo > CurrentPet
Definition: PetDefines.h:225
PetStable & GetOrInitPetStable()
Definition: Player.cpp:15532
void SetPetNumber(uint32 petnumber, bool statwindow)
Definition: CharmInfo.cpp:247
void SetFullHealth()
Definition: Unit.h:797
void SetFaction(uint32 faction)
Definition: Unit.cpp:9998
void ReplaceAllUnitFlags(UnitFlags flags)
Remove the Unit flag specify only.
Definition: Unit.h:828
CharmInfo * GetCharmInfo()
Definition: Unit.h:1226
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1160

References PetStable::CurrentPet, Pet::FillPetInfo(), GetCharmInfo(), Object::GetEntry(), GetFaction(), Object::GetGUID(), Player::GetOrInitPetStable(), PetStable::GetUnslottedHunterPet(), Pet::InitPetCreateSpells(), Guardian::InitStatsForLevel(), Object::IsPlayer(), LOG_ERROR, ReplaceAllUnitFlags(), SetCreatorGUID(), SetFaction(), SetFullHealth(), CharmInfo::SetPetNumber(), SetUInt32Value(), sObjectMgr, Object::ToPlayer(), UNIT_CREATED_BY_SPELL, and UNIT_FLAG_PLAYER_CONTROLLED.

Referenced by CreateTamedPetFrom().

◆ InterruptNonMeleeSpells()

void Unit::InterruptNonMeleeSpells ( bool  withDelayed,
uint32  spellid = 0,
bool  withInstant = true,
bool  bySelf = false 
)
4095{
4096 // generic spells are interrupted if they are not finished or delayed
4097 if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
4098 InterruptSpell(CURRENT_GENERIC_SPELL, withDelayed, withInstant, bySelf);
4099
4100 // autorepeat spells are interrupted if they are not finished or delayed
4101 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
4102 InterruptSpell(CURRENT_AUTOREPEAT_SPELL, withDelayed, withInstant, bySelf);
4103
4104 // channeled spells are interrupted if they are not finished, even if they are delayed
4105 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
4106 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
4107}

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, InterruptSpell(), and m_currentSpells.

Referenced by _EnterVehicle(), PetAI::_stopAttack(), Player::ActivateSpec(), npc_dark_nucleus::npc_dark_nucleusAI::AttackStart(), CleanupBeforeRemoveFromMap(), CombatStop(), boss_julianne::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_onyxia::DamageTaken(), boss_volazj::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DamageTaken(), DealDamage(), boss_leotheras_the_blind::DemonTime(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_medivh_bm::DoAction(), boss_thorim_sif::boss_thorim_sifAI::DoAction(), boss_nazan::DoAction(), npc_ranshalla::npc_ranshallaAI::DoContinueEscort(), Spell::EffectKnockBack(), boss_leotheras_the_blind::ElfTime(), spell_dk_death_grip::HandleBaseDummy(), WorldSession::HandleCancelCastOpcode(), spell_magtheridon_shadow_grasp::HandleDummyRemove(), spell_novos_crystal_handler_death_aura::HandleEffectApply(), spell_hydross_cleansing_field_command::HandleEffectRemove(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLootOpcode(), WorldSession::HandlePetActionHelper(), spell_the_lich_king_jump::HandleScript(), boss_akilzon::boss_akilzonAI::HandleStormSequence(), npc_kilrek::JustEngagedWith(), boss_archimonde::JustEngagedWith(), boss_infinite_corruptor::boss_infinite_corruptorAI::JustEngagedWith(), boss_taldaram::JustEngagedWith(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::JustEngagedWith(), boss_urom::boss_uromAI::JustEngagedWith(), boss_thorim_runic_colossus::boss_thorim_runic_colossusAI::JustEngagedWith(), boss_kelidan_the_breaker::JustEngagedWith(), boss_curator::JustEngagedWith(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustEngagedWith(), boss_gal_darah::boss_gal_darahAI::JustEngagedWith(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustEngagedWith(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustEngagedWith(), violet_hold_trashAI::JustEngagedWith(), PetAI::KilledUnit(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), boss_shade_of_aran::OnPowerUpdate(), boss_jeklik::PathEndReached(), PretendToDie(), boss_alar::PretendToDie(), SmartScript::ProcessAction(), RemoveAurasWithInterruptFlags(), boss_curator::Reset(), boss_malchezaar::Reset(), boss_varos::boss_varosAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), boss_talon_king_ikiss::Reset(), boss_high_astromancer_solarian::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), boss_the_lurker_below::SchedulerPhaseOne(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), boss_anomalus::boss_anomalusAI::SetData(), setDeathState(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), boss_razorscale::boss_razorscaleAI::SpellHit(), StopAttackFaction(), Player::TeleportTo(), CasterAI::UpdateAI(), TotemAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_felblood_kaelthas::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), npc_scholomance_occultist::npc_scholomance_occultistAI::UpdateAI(), boss_paletress::boss_paletressAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), npc_dark_nucleus::npc_dark_nucleusAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and PetAI::UpdateAI().

◆ InterruptSpell()

void Unit::InterruptSpell ( CurrentSpellTypes  spellType,
bool  withDelayed = true,
bool  withInstant = true,
bool  bySelf = false 
)
4028{
4029 //LOG_DEBUG("entities.unit", "Interrupt spell for unit {}.", GetEntry());
4030 Spell* spell = m_currentSpells[spellType];
4031 if (spell
4032 && (withDelayed || spell->getState() != SPELL_STATE_DELAYED)
4033 && (withInstant || spell->GetCastTime() > 0 || spell->getState() == SPELL_STATE_CASTING)) // xinef: or spell is in casting state (channeled spells only)
4034 {
4035 // for example, do not let self-stun aura interrupt itself
4036 if (!spell->IsInterruptable())
4037 return;
4038
4039 // send autorepeat cancel message for autorepeat spells
4040 if (spellType == CURRENT_AUTOREPEAT_SPELL)
4041 if (IsPlayer())
4043
4044 if (spell->getState() != SPELL_STATE_FINISHED)
4045 spell->cancel(bySelf);
4046
4047 m_currentSpells[spellType] = nullptr;
4048 spell->SetReferencedFromCurrent(false);
4049 }
4050}
@ SPELL_STATE_DELAYED
Definition: Spell.h:228
void SendAutoRepeatCancel(Unit *target)
Definition: PlayerMisc.cpp:152
bool IsInterruptable() const
Definition: Spell.h:560
int32 GetCastTime() const
Definition: Spell.h:547
uint32 getState() const
Definition: Spell.h:482
void cancel(bool bySelf=false)
Definition: Spell.cpp:3710

References Spell::cancel(), CURRENT_AUTOREPEAT_SPELL, Spell::GetCastTime(), Spell::getState(), Spell::IsInterruptable(), Object::IsPlayer(), m_currentSpells, Player::SendAutoRepeatCancel(), Spell::SetReferencedFromCurrent(), SPELL_STATE_CASTING, SPELL_STATE_DELAYED, SPELL_STATE_FINISHED, and Object::ToPlayer().

Referenced by _UpdateAutoRepeatSpell(), Player::ActivateTaxiPathTo(), Attack(), AttackStop(), CastStop(), Spell::EffectInterruptCast(), Spell::EffectSanctuary(), AuraEffect::HandleAuraModSilence(), WorldSession::HandleCancelAuraOpcode(), WorldSession::HandleCancelAutoRepeatSpellOpcode(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleCancelChanneling(), spell_hun_scatter_shot::HandleDummy(), AuraEffect::HandleFeignDeath(), InterruptNonMeleeSpells(), SmartAI::JustEngagedWith(), Player::RemoveItemDependentAurasAndCasts(), SetCurrentCastedSpell(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_nightbane::TriggerHealthTakeOff(), and npc_belnistrasz::npc_belnistraszAI::UpdateAI().

◆ InvalidateValuesUpdateCache()

void Unit::InvalidateValuesUpdateCache ( )
inlineprivate
1906{ _valuesUpdateCache.clear(); }

References _valuesUpdateCache.

Referenced by SetUInt32Value(), and Update().

◆ IsAlive()

bool Unit::IsAlive ( ) const
inline
1151{ return (m_deathState == DeathState::Alive); };

References m_deathState.

Referenced by _CreateAuraApplication(), CreatureAI::_EnterEvadeMode(), _EnterVehicle(), _IsValidAssistTarget(), _IsValidAttackTarget(), Player::_LoadItem(), BossAI::_Reset(), WorldBossAI::_Reset(), KillRewarder::_RewardHonor(), KillRewarder::_RewardKillCredit(), KillRewarder::_RewardXP(), PetAI::_stopAttack(), AddAura(), Map::AddPlayerToMap(), HostileReference::AddThreat(), Spell::AddUnitTarget(), Attack(), PetAI::AttackedBy(), AttackerStateUpdate(), boss_freya::boss_freyaAI::boss_freyaAI(), boss_hodir::boss_hodirAI::boss_hodirAI(), boss_mimiron::boss_mimironAI::boss_mimironAI(), boss_thorim::boss_thorimAI::boss_thorimAI(), WorldSession::BuildPartyMemberStatsChangedPacket(), Player::BuyItemFromVendorSlot(), CalcAbsorbResist(), CalculateMeleeDamage(), CalculateSpellDamageTaken(), instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj_InstanceMapScript::CallNextRajaxxLeader(), Creature::CanAssistTo(), PetAI::CanAttack(), Player::CanCaptureTowerPoint(), CanHaveThreatList(), Player::CanInteractWithQuestGiver(), Player::CanUseAmmo(), Player::CanUseBattlegroundObject(), Player::CanUseItem(), Player::CastItemCombatSpell(), Player::CheckAreaExploreAndOutdoor(), spell_dk_raise_ally::CheckCast(), spell_hun_check_pet_los::CheckCast(), spell_hun_pet_heart_of_the_phoenix::CheckCast(), spell_hun_bestial_wrath::CheckCast(), Spell::CheckCast(), boss_gothik::boss_gothikAI::CheckGroupSplitted(), BattlegroundRV::CheckPositionForUnit(), spell_mage_focus_magic::CheckProc(), spell_dk_blood_caked_blade::CheckProc(), spell_dk_dancing_rune_weapon::CheckProc(), spell_item_necrotic_touch::CheckProc(), spell_pal_seal_of_righteousness::CheckProc(), spell_warl_siphon_life::CheckProc(), spell_putricide_mutation_init::CheckRequirementInternal(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CreatureUnitRelocationWorker(), DealDamage(), DealDamageMods(), DealMeleeDamage(), DealSpellDamage(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), Creature::DisappearAndDie(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_xerestrasza::npc_xerestraszaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_sister_svalna::boss_sister_svalnaAI::DoAction(), boss_high_king_maulgar::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_infinite_corruptor::boss_infinite_corruptorAI::DoAction(), boss_tharon_ja::boss_tharon_jaAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), Spell::DoAllEffectOnTarget(), spell_hun_masters_call::DoCheckCast(), RandomMovementGenerator< T >::DoInitialize(), WorldSession::DoLootRelease(), WaypointMovementGenerator< Creature >::DoUpdate(), instance_blackrock_spire::instance_blackrock_spireMapScript::Dragonspireroomcheck(), Spell::EffectAddExtraAttacks(), Spell::EffectEnergize(), Spell::EffectEnergizePct(), Spell::EffectEnvironmentalDMG(), Spell::EffectFeedPet(), Spell::EffectHeal(), Spell::EffectHealMaxHealth(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), Spell::EffectHealthLeech(), Spell::EffectInstaKill(), Spell::EffectInterruptCast(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectResurrect(), Spell::EffectResurrectNew(), Spell::EffectResurrectPet(), Spell::EffectSchoolDMG(), Spell::EffectScriptEffect(), Spell::EffectSelfResurrect(), Spell::EffectSkinPlayerCorpse(), Spell::EffectStuck(), Spell::EffectThreat(), Spell::EffectWeaponDmg(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), npc_tirion_fordring_tft::npc_tirion_fordringAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::EnterEvadeMode(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), npc_terenas_menethil::npc_terenas_menethilAI::EnterEvadeMode(), npc_pet_mage_mirror_image::EnterEvadeMode(), Player::EnvironmentalDamage(), Player::EquipItem(), BattleExperienceEvent::Execute(), DelayedMovementEvent::Execute(), IceTombSummonEvent::Execute(), SACActivateEvent::Execute(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::ExecuteEvent(), AssistanceMovementGenerator::Finalize(), Creature::ForcedDespawn(), CreatureGroup::FormationReset(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::GetData(), GetDebugInfo(), Player::GetInitialVisiblePackets(), FollowerAI::GetLeaderForFollower(), Player::getMaxTimer(), CreatureGroup::GetNewTargetForMember(), Player::GetNPCIfCanInteractWith(), GetPartyMembers(), npc_air_force_bots::npc_air_force_botsAI::GetSummonedGuard(), npc_wild_wyrm::npc_wild_wyrmAI::GetValidPlayer(), Pet::GivePetXP(), Player::GiveXP(), go_wind_stone::go_wind_stoneAI::GossipSelect(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), BattlegroundEY::HandleAreaTrigger(), BattlegroundWS::HandleAreaTrigger(), WorldSession::HandleAreaTriggerOpcode(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModTotalThreat(), WorldSession::HandleAutostoreLootItemOpcode(), WorldSession::HandleBattleFieldPortOpcode(), misc_commandscript::HandleDamageCommand(), misc_commandscript::HandleDieCommand(), Player::HandleDrowning(), HandleDummyAuraProc(), WorldSession::HandleEmoteOpcode(), Player::HandleFall(), misc_commandscript::HandleFreezeCommand(), WorldSession::HandleInitiateTradeOpcode(), WorldSession::HandleLootMoneyOpcode(), WorldSession::HandleMessagechatOpcode(), AuraEffect::HandleModTaunt(), AuraEffect::HandleModTotalPercentStat(), WorldSession::HandleMovementOpcodes(), npc_commandscript::HandleNpcMoveCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetWanderDistanceCommand(), AuraEffect::HandleObsModPowerAuraTick(), spell_yogg_saron_brain_link_aura::HandleOnEffectApply(), WorldSession::HandleOpenItemOpcode(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), WorldSession::HandlePetAction(), WorldSession::HandlePetCancelAuraOpcode(), WorldSession::HandlePetStopAttack(), misc_commandscript::HandlePInfoCommand(), spell_pal_seal_of_command_aura::HandleProc(), HandleProcTriggerSpell(), WorldSession::HandleReclaimCorpseOpcode(), WorldSession::HandleRepopRequestOpcode(), WorldSession::HandleRequestPartyMemberStatsOpcode(), ArenaSpectator::HandleResetCommand(), WorldSession::HandleSetAmmoOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), misc_commandscript::HandleSkirmishCommand(), ArenaSpectator::HandleSpectatorSpectateCommand(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleSummonResponseOpcode(), WorldSession::HandleUnstablePet(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), boss_moroes::InitializeGuests(), Player::IsAtGroupRewardDistance(), Player::IsAtRecruitAFriendDistance(), Creature::IsInvisibleDueToDespawn(), Player::IsOutdoorPvPActive(), Player::IsPetNeedBeTemporaryUnsummoned(), isTargetableForAttack(), IsValidCombatTarget(), Spell::IsValidDeadOrAliveTarget(), ThreatCalcHelper::isValidProcess(), npc_kilrek::JustDied(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustDied(), boss_rajaxx::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::JustEngagedWith(), boss_freya::boss_freyaAI::JustEngagedWith(), npc_underbat::JustEngagedWith(), boss_sartharion::boss_sartharionAI::JustEngagedWith(), boss_fathomlord_karathress::JustReachedHome(), boss_rotface::boss_rotfaceAI::JustSummoned(), Kill(), boss_hadronox::boss_hadronoxAI::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), CreatureGroup::LeaderMoveTo(), Player::LoadCorpse(), Player::LoadFromDB(), LoadHelper(), MagicSpellHitResult(), AchievementCriteriaData::Meets(), CreatureGroup::MemberEngagingTarget(), CreatureGroup::MemberEvaded(), npc_twiggy_flathead::npc_twiggy_flatheadAI::MoveInLineOfSight(), boss_lord_marrowgar::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_uldaman::instance_uldaman_InstanceMapScript::OnCreatureCreate(), instance_temple_of_ahnqiraj::instance_temple_of_ahnqiraj_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnCreatureCreate(), go_palehoof_sphere::OnGossipHello(), go_jotunheim_cage::OnGossipHello(), go_dragonflayer_cage::OnGossipHello(), spell_yogg_saron_brain_link_aura::OnPeriodic(), instance_violet_hold::instance_violet_hold_InstanceMapScript::OnPlayerEnter(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::OnPlayerEnter(), at_orb_of_command::OnTrigger(), at_ancient_leaf::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_celestial_planetarium_enterance::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), AreaTrigger_at_nats_landing::OnTrigger(), AreaTrigger_at_sentry_point::OnTrigger(), SmartTrigger::OnTrigger(), AreaTrigger_at_area_52_entrance::OnTrigger(), at_dragonspire_hall::OnTrigger(), at_blackrock_stadium::OnTrigger(), near_scarshield_infiltrator::OnTrigger(), at_scarshield_infiltrator::OnTrigger(), at_commander_dawnforge::OnTrigger(), RisenArchmageCheck::operator()(), WretchedGhoulCleaner::operator()(), ValithriaDespawner::operator()(), Acore::NearestCreatureEntryWithLiveStateInObjectRangeCheck::operator()(), Acore::PlayerAtMinimumRangeAway::operator()(), Acore::AnyDeadUnitObjectInRangeCheck::operator()(), Acore::AnyPlayerInObjectRangeCheck::operator()(), Acore::NearestPlayerInObjectRangeCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::AnyUnitInObjectRangeCheck::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), Acore::AnyDeadUnitCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::MostHPMissingGroupInRange::operator()(), FrostwingVrykulSearcher::operator()(), Acore::AllDeadCreaturesInRange::operator()(), ShadowTrapLKTargetSelector::operator()(), NonTankLKTargetSelector::operator()(), DefileTargetSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), PetAI::OwnerAttacked(), npc_pet_gen_valkyr_guardian::OwnerAttacked(), PetAI::OwnerAttackedBy(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), MapMgr::PlayerCannotEnter(), ProcDamageAndSpell(), RemoveCharmedBy(), Group::RemoveMember(), Player::RemovePet(), Battleground::RemovePlayerAtLeave(), Player::RepopAtGraveyard(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::Reset(), boss_fathomlord_karathress::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), Creature::Respawn(), Player::RewardPlayerAndGroupAtEvent(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), Player::SendLoot(), npc_corrupted_totem::SetAura(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), SetConfused(), boss_emperor_dagran_thaurissan::boss_draganthaurissanAI::SetData(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::SetData(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::SetData(), boss_teron_gorefiend::SetData(), Player::setDeathState(), Creature::SetDisableGravity(), SetFeared(), Creature::SetHover(), SetInCombatState(), SetStunned(), Battlefield::ShowNpc(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), npc_dark_iron_guzzler::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_hor_lich_king::npc_hor_lich_kingAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), WaypointMovementGenerator< Creature >::StartMove(), PassengerController::SummonCreatures(), boss_rend_blackhand::boss_rend_blackhandAI::SummonedCreatureDespawn(), boss_priestess_delrissa::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), Player::SwapItem(), lfg::LFGMgr::TeleportPlayer(), BattlegroundRV::TeleportUnitToNewZ(), Pet::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Puppet::Update(), Player::Update(), Totem::Update(), Update(), TimedFleeingMovementGenerator::Update(), TotemAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_dark_iron_guzzler::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_taldaram::UpdateAI(), boss_gormok::boss_gormokAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_ice_tomb::npc_ice_tombAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::UpdateAI(), boss_vezax::boss_vezaxAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_erekem::boss_erekemAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), PetAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), npc_tooga::npc_toogaAI::UpdateFollowerAI(), npc_ringo::npc_ringoAI::UpdateFollowerAI(), InstanceScript::UpdateMinionState(), Creature::UpdateMovementFlags(), boss_netherspite::UpdatePortals(), boss_twin_valkyrAI::UpdateSharedHealth(), UpdateSplineMovement(), Player::UpdateZone(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsAlwaysDetectableFor()

bool Unit::IsAlwaysDetectableFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

14144{
14146 return true;
14147
14148 if (HasAuraTypeWithCaster(SPELL_AURA_MOD_STALKED, seer->GetGUID()))
14149 return true;
14150
14151 if (Player* ownerPlayer = GetSpellModOwner())
14152 if (Player const* seerPlayer = seer->ToPlayer())
14153 {
14154 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
14155 return true;
14156 }
14157
14158 return false;
14159}
@ SPELL_AURA_MOD_STALKED
Definition: SpellAuraDefines.h:131
virtual bool IsAlwaysDetectableFor(WorldObject const *) const
Definition: Object.h:664

References Object::GetGUID(), GetSpellModOwner(), HasAuraTypeWithCaster(), WorldObject::IsAlwaysDetectableFor(), SPELL_AURA_MOD_STALKED, and Object::ToPlayer().

Referenced by Creature::IsAlwaysDetectableFor(), and Player::IsAlwaysDetectableFor().

◆ IsAlwaysVisibleFor()

bool Unit::IsAlwaysVisibleFor ( WorldObject const *  seer) const
overrideprotectedvirtual

Reimplemented from WorldObject.

14125{
14127 return true;
14128
14129 // Always seen by owner
14130 if (ObjectGuid guid = GetCharmerOrOwnerGUID())
14131 if (seer->GetGUID() == guid)
14132 return true;
14133
14134 if (Player const* seerPlayer = seer->ToPlayer())
14135 if (Unit* owner = GetOwner())
14136 if (Player* ownerPlayer = owner->ToPlayer())
14137 if (ownerPlayer->IsGroupVisibleFor(seerPlayer))
14138 return true;
14139
14140 return false;
14141}
virtual bool IsAlwaysVisibleFor(WorldObject const *) const
Definition: Object.h:661

References GetCharmerOrOwnerGUID(), Object::GetGUID(), GetOwner(), WorldObject::IsAlwaysVisibleFor(), and Object::ToPlayer().

◆ IsArmorer()

bool Unit::IsArmorer ( ) const
inline
@ UNIT_NPC_FLAG_REPAIR
Definition: UnitDefines.h:306
bool HasNpcFlag(NPCFlags flags) const
Definition: Unit.h:991

References HasNpcFlag(), and UNIT_NPC_FLAG_REPAIR.

◆ isAttackingPlayer()

bool Unit::isAttackingPlayer ( ) const
10403{
10405 return true;
10406
10407 if (!m_Controlled.empty())
10408 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10409 if ((*itr)->isAttackingPlayer())
10410 return true;
10411
10412 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
10413 if (m_SummonSlot[i])
10414 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
10415 if (summon->isAttackingPlayer())
10416 return true;
10417
10418 return false;
10419}

References WorldObject::GetMap(), HasUnitState(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, and UNIT_STATE_ATTACK_PLAYER.

◆ isAttackReady()

◆ IsAuctioner()

bool Unit::IsAuctioner ( ) const
inline
@ UNIT_NPC_FLAG_AUCTIONEER
Definition: UnitDefines.h:315

References HasNpcFlag(), and UNIT_NPC_FLAG_AUCTIONEER.

◆ IsBanker()

bool Unit::IsBanker ( ) const
inline
@ UNIT_NPC_FLAG_BANKER
Definition: UnitDefines.h:311

References HasNpcFlag(), and UNIT_NPC_FLAG_BANKER.

◆ IsBattleMaster()

bool Unit::IsBattleMaster ( ) const
inline

◆ isBeingLoaded()

virtual bool Unit::isBeingLoaded ( ) const
inlinevirtual

Reimplemented in Pet, and Player.

1738{ return false;}

Referenced by Player::SetMover().

◆ isBlockCritical()

bool Unit::isBlockCritical ( )
3094{
3096 return true;
3097 return false;
3098}
@ SPELL_AURA_MOD_BLOCK_CRIT_CHANCE
Definition: SpellAuraDefines.h:316

References GetTotalAuraModifier(), roll_chance_i(), and SPELL_AURA_MOD_BLOCK_CRIT_CHANCE.

Referenced by CalculateMeleeDamage(), and CalculateSpellDamageTaken().

◆ IsCharmed()

◆ IsCharmedOwnedByPlayerOrPlayer()

bool Unit::IsCharmedOwnedByPlayerOrPlayer ( ) const
inline
ObjectGuid GetCharmerOrOwnerOrOwnGUID() const
Definition: Unit.h:1174

References GetCharmerOrOwnerOrOwnGUID(), and ObjectGuid::IsPlayer().

Referenced by Spell::DoSpellHitOnUnit(), and ProcDamageAndSpellFor().

◆ IsClass()

◆ IsContestedGuard()

bool Unit::IsContestedGuard ( ) const
inline
855 {
857 return entry->IsContestedGuardFaction();
858
859 return false;
860 }

References GetFactionTemplateEntry().

Referenced by Acore::NearestVisibleDetectableContestedGuardUnitCheck::operator()().

◆ IsControllableGuardian()

bool Unit::IsControllableGuardian ( ) const
inline

◆ IsControlledByPlayer()

◆ IsCreatedByPlayer()

bool Unit::IsCreatedByPlayer ( ) const
inline
1172{ return m_CreatedByPlayer; }

References m_CreatedByPlayer.

Referenced by DealDamage().

◆ IsCritter()

◆ IsDamageReducedByArmor()

bool Unit::IsDamageReducedByArmor ( SpellSchoolMask  damageSchoolMask,
SpellInfo const *  spellInfo = nullptr,
uint8  effIndex = MAX_SPELL_EFFECTS 
)
static
1976{
1977 // only physical spells damage gets reduced by armor
1978 if ((schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
1979 return false;
1980 if (spellInfo)
1981 {
1982 // there are spells with no specific attribute but they have "ignores armor" in tooltip
1983 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_IGNORE_ARMOR))
1984 return false;
1985
1986 // bleeding effects are not reduced by armor
1987 if (effIndex != MAX_SPELL_EFFECTS)
1988 {
1989 if (spellInfo->Effects[effIndex].ApplyAuraName == SPELL_AURA_PERIODIC_DAMAGE ||
1990 spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
1991 if (spellInfo->GetEffectMechanicMask(effIndex) & (1 << MECHANIC_BLEED))
1992 return false;
1993 }
1994 }
1995 return true;
1996}
@ SPELL_ATTR0_CU_IGNORE_ARMOR
Definition: SpellInfo.h:191
@ MECHANIC_BLEED
Definition: SharedDefines.h:1340

References SpellInfo::Effects, SpellInfo::GetEffectMechanicMask(), SpellInfo::HasAttribute(), MAX_SPELL_EFFECTS, MECHANIC_BLEED, SPELL_ATTR0_CU_IGNORE_ARMOR, SPELL_AURA_PERIODIC_DAMAGE, SPELL_EFFECT_SCHOOL_DAMAGE, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by CalculateMeleeDamage(), CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ isDead()

bool Unit::isDead ( ) const
inline
1153{ return (m_deathState == DeathState::Dead || m_deathState == DeathState::Corpse); };

References m_deathState.

Referenced by npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::CheckEventFail(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), Spell::EffectSummonPet(), AuraEffect::HandleAuraDummy(), Player::HandleFall(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), misc_commandscript::HandleRespawnCommand(), spell_prince_taldaram_conjure_flame_sphere::HandleScript(), Creature::HasSpellFocus(), UnitAI::InitializeAI(), SmartAI::InitializeAI(), npc_troll_volunteer::npc_troll_volunteerAI::InitializeAI(), npc_spinestalker::npc_spinestalkerAI::InitializeAI(), npc_rimefang::npc_rimefangAI::InitializeAI(), npc_sindragosa_trash::npc_sindragosa_trashAI::InitializeAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), Player::isAllowedToLoot(), npc_anubisath_sentinel::aqsentinelAI::JustDied(), Player::OnGossipSelect(), AreaTrigger_at_stormwright_shelf::OnTrigger(), AreaTrigger_at_scent_larkorwi::OnTrigger(), at_bring_your_orphan_to::OnTrigger(), Player::PrepareGossipMenu(), SmartScript::ProcessAction(), Player::RepopAtGraveyard(), npc_anubisath_sentinel::aqsentinelAI::Reset(), WorldSession::SendAttackStop(), SendMeleeAttackStop(), instance_molten_core::instance_molten_core_InstanceMapScript::SetBossState(), and npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI().

◆ IsDuringRemoveFromWorld()

◆ isDying()

bool Unit::isDying ( ) const
inline
1152{ return (m_deathState == DeathState::JustDied); };

References m_deathState.

Referenced by CanHaveThreatList(), and SetHover().

◆ IsEngaged()

◆ IsEngagedBy()

bool Unit::IsEngagedBy ( Unit const *  who) const
inline
1030{ return IsInCombatWith(who); }

References IsInCombatWith().

Referenced by Creature::_IsTargetAcceptable(), and Creature::Update().

◆ IsFalling()

bool Unit::IsFalling ( ) const

◆ isFeared()

◆ IsFFAPvP()

bool Unit::IsFFAPvP ( ) const
inline

◆ IsFlying()

◆ IsFriendlyTo()

bool Unit::IsFriendlyTo ( Unit const *  unit) const
10184{
10185 return GetReactionTo(unit) >= REP_FRIENDLY;
10186}

References GetReactionTo(), and REP_FRIENDLY.

Referenced by Spell::_cast(), AuraApplication::_InitFlags(), Creature::_IsTargetAcceptable(), FollowerAI::AssistPlayerInCombatAgainst(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::AttackedBy(), Creature::CanAssistTo(), spell_dk_death_coil::CheckCast(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), Spell::CheckCast(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), Spell::EffectDispel(), Spell::EffectDispelMechanic(), Spell::EffectStealBeneficialBuff(), Spell::EffectThreat(), Aura::HandleAuraSpecificMods(), spell_dk_death_coil::HandleDummy(), spell_pal_holy_shock::HandleDummy(), spell_pri_penance::HandleDummy(), HandleDummyAuraProc(), BattlefieldWG::HandleKill(), spell_winter_veil_shoot_air_rifle::HandleScriptEffect(), WorldSession::HandleSetSelectionOpcode(), Spell::HandleThreatSpells(), GameObject::IsAlwaysVisibleFor(), SpellClickInfo::IsFitToRequirements(), npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(), Acore::AnyUnfriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyUnitInObjectRangeCheck::operator()(), Acore::AnyFriendlyNotSelfUnitInObjectRangeCheck::operator()(), Acore::AllFriendlyCreaturesInGrid::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), PetSpellFail(), SmartScript::ProcessEvent(), RemoveCharmedBy(), Spell::SelectExplicitTargets(), Player::SendLoot(), Acore::MessageDistDelivererToHostile::SendPacket(), and TotemAI::UpdateAI().

◆ isFrozen()

◆ IsFullHealth()

◆ IsGossip()

bool Unit::IsGossip ( ) const
inline
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294

References HasNpcFlag(), and UNIT_NPC_FLAG_GOSSIP.

◆ IsGuardian()

◆ IsGuildMaster()

bool Unit::IsGuildMaster ( ) const
inline
@ UNIT_NPC_FLAG_PETITIONER
Definition: UnitDefines.h:312

References HasNpcFlag(), and UNIT_NPC_FLAG_PETITIONER.

◆ IsHostileTo()

◆ IsHostileToPlayers()

bool Unit::IsHostileToPlayers ( ) const
10189{
10190 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
10191 if (!my_faction || !my_faction->faction)
10192 return false;
10193
10194 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
10195 if (raw_faction && raw_faction->reputationListID >= 0)
10196 return false;
10197
10198 return my_faction->IsHostileToPlayers();
10199}
int32 reputationListID
Definition: DBCStructure.h:909
uint32 faction
Definition: DBCStructure.h:941
bool IsHostileToPlayers() const
Definition: DBCStructure.h:981

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsHostileToPlayers(), FactionEntry::reputationListID, and sFactionStore.

◆ IsHovering()

◆ IsHunterPet()

◆ IsImmunedToDamage() [1/3]

bool Unit::IsImmunedToDamage ( Spell const *  spell) const
12731{
12732 SpellInfo const* spellInfo = spell->GetSpellInfo();
12733 if (!spellInfo)
12734 {
12735 return false;
12736 }
12737
12739 {
12740 return false;
12741 }
12742
12744 {
12745 return false;
12746 }
12747
12748 uint32 schoolMask = spell->GetSpellSchoolMask();
12749 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12750 {
12751 return false;
12752 }
12753
12754 // If m_immuneToDamage type contain magic, IMMUNE damage.
12755 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12756 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12757 {
12758 if ((itr->type & schoolMask) == schoolMask)
12759 {
12760 return true;
12761 }
12762 }
12763
12764 return false;
12765}
std::vector< SpellImmune > SpellImmuneList
Definition: SpellDefines.h:180
@ SPELL_ATTR2_NO_SCHOOL_IMMUNITIES
Definition: SharedDefines.h:482
@ SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS
Definition: SharedDefines.h:435
@ IMMUNITY_DAMAGE
Definition: SharedDefines.h:1397
@ SPELL_SCHOOL_MASK_NONE
Definition: SharedDefines.h:296

References Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [2/3]

bool Unit::IsImmunedToDamage ( SpellInfo const *  spellInfo) const
12699{
12700 if (!spellInfo)
12701 {
12702 return false;
12703 }
12704
12706 {
12707 return false;
12708 }
12709
12710 if (spellInfo->HasAttribute(SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS) || spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
12711 {
12712 return false;
12713 }
12714
12715 uint32 schoolMask = spellInfo->GetSchoolMask();
12716 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12717 {
12718 return false;
12719 }
12720
12721 // If m_immuneToDamage type contain magic, IMMUNE damage.
12722 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12723 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12724 if((itr->type & schoolMask) == schoolMask)
12725 return true;
12726
12727 return false;
12728}

References SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), IMMUNITY_DAMAGE, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR1_IMMUNITY_TO_HOSTILE_AND_FRIENDLY_EFFECTS, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, and SPELL_SCHOOL_MASK_NONE.

◆ IsImmunedToDamage() [3/3]

bool Unit::IsImmunedToDamage ( SpellSchoolMask  meleeSchoolMask) const
12683{
12684 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
12685 {
12686 return false;
12687 }
12688
12689 // If m_immuneToDamage type contain magic, IMMUNE damage.
12690 SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
12691 for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
12692 if((itr->type & meleeSchoolMask) == meleeSchoolMask)
12693 return true;
12694
12695 return false;
12696}

References IMMUNITY_DAMAGE, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by Spell::DoSpellHitOnUnit(), and IsImmunedToDamageOrSchool().

◆ IsImmunedToDamageOrSchool() [1/2]

bool Unit::IsImmunedToDamageOrSchool ( SpellInfo const *  spellInfo) const
12847{
12848 return IsImmunedToDamage(spellInfo) || IsImmunedToSchool(spellInfo);
12849}
bool IsImmunedToSchool(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12767
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask) const
Definition: Unit.cpp:12682

References IsImmunedToDamage(), and IsImmunedToSchool().

◆ IsImmunedToDamageOrSchool() [2/2]

◆ IsImmunedToSchool() [1/3]

bool Unit::IsImmunedToSchool ( Spell const *  spell) const
12807{
12808 SpellInfo const* spellInfo = spell->GetSpellInfo();
12810 {
12811 return false;
12812 }
12813
12814 uint32 schoolMask = spell->GetSpellSchoolMask();
12815 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12816 {
12817 return false;
12818 }
12819
12820 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12821 {
12822 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12823 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12824 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12825 {
12826 if ((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
12827 {
12828 return true;
12829 }
12830 }
12831 }
12832
12833 return false;
12834}
@ IMMUNITY_SCHOOL
Definition: SharedDefines.h:1396
bool CanPierceImmuneAura(SpellInfo const *aura) const
Definition: SpellInfo.cpp:1322

References SpellInfo::CanPierceImmuneAura(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [2/3]

bool Unit::IsImmunedToSchool ( SpellInfo const *  spellInfo) const
12784{
12786 return false;
12787
12788 uint32 schoolMask = spellInfo->GetSchoolMask();
12789 if (schoolMask == SPELL_SCHOOL_MASK_NONE)
12790 {
12791 return false;
12792 }
12793
12794 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12795 {
12796 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12797 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12798 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12799 if((itr->type & schoolMask) == schoolMask && !spellInfo->CanPierceImmuneAura(sSpellMgr->GetSpellInfo(itr->spellId)))
12800 return true;
12801 }
12802
12803 return false;
12804}

References SpellInfo::CanPierceImmuneAura(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), SpellInfo::Id, IMMUNITY_SCHOOL, m_spellImmune, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

◆ IsImmunedToSchool() [3/3]

bool Unit::IsImmunedToSchool ( SpellSchoolMask  meleeSchoolMask) const
12768{
12769 if (meleeSchoolMask == SPELL_SCHOOL_MASK_NONE)
12770 {
12771 return false;
12772 }
12773
12774 // If m_immuneToSchool type contain this school type, IMMUNE damage.
12775 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12776 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12777 if((itr->type & meleeSchoolMask) == meleeSchoolMask)
12778 return true;
12779
12780 return false;
12781}

References IMMUNITY_SCHOOL, m_spellImmune, and SPELL_SCHOOL_MASK_NONE.

Referenced by Spell::DoSpellHitOnUnit(), IsImmunedToDamageOrSchool(), and SpellHitResult().

◆ IsImmunedToSpell()

bool Unit::IsImmunedToSpell ( SpellInfo const *  spellInfo,
Spell const *  spell = nullptr 
)
virtual

Reimplemented in Creature.

12852{
12853 if (!spellInfo)
12854 return false;
12855
12856 // Single spell immunity.
12857 SpellImmuneList const& idList = m_spellImmune[IMMUNITY_ID];
12858 for (SpellImmuneList::const_iterator itr = idList.begin(); itr != idList.end(); ++itr)
12859 if (itr->type == spellInfo->Id)
12860 return true;
12861
12862 // xinef: my special immunity, if spellid is not on this list it means npc is immune
12863 SpellImmuneList const& allowIdList = m_spellImmune[IMMUNITY_ALLOW_ID];
12864 if (!allowIdList.empty())
12865 {
12866 for (SpellImmuneList::const_iterator itr = allowIdList.begin(); itr != allowIdList.end(); ++itr)
12867 if (itr->type == spellInfo->Id)
12868 return false;
12869 return true;
12870 }
12871
12873 return false;
12874
12875 if (spellInfo->Dispel)
12876 {
12877 SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
12878 for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr)
12879 if (itr->type == spellInfo->Dispel)
12880 return true;
12881 }
12882
12883 // Spells that don't have effectMechanics.
12884 if (spellInfo->Mechanic)
12885 {
12886 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
12887 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
12888 if (itr->type == spellInfo->Mechanic)
12889 return true;
12890 }
12891
12892 bool immuneToAllEffects = true;
12893 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12894 {
12895 // State/effect immunities applied by aura expect full spell immunity
12896 // Ignore effects with mechanic, they are supposed to be checked separately
12897 if (!spellInfo->Effects[i].IsEffect())
12898 continue;
12899
12900 // Xinef: if target is immune to one effect, and the spell has transform aura - it is immune to whole spell
12901 if (IsImmunedToSpellEffect(spellInfo, i))
12902 {
12903 if (spellInfo->HasAura(SPELL_AURA_TRANSFORM))
12904 return true;
12905 continue;
12906 }
12907
12908 immuneToAllEffects = false;
12909 break;
12910 }
12911 if (immuneToAllEffects) //Return immune only if the target is immune to all spell effects.
12912 return true;
12913
12914 if (spellInfo->Id != 42292 && spellInfo->Id != 59752 && spellInfo->Id != 19574 && spellInfo->Id != 34471)
12915 {
12916 SpellSchoolMask spellSchoolMask = spellInfo->GetSchoolMask();
12917 if (spell)
12918 {
12919 spellSchoolMask = spell->GetSpellSchoolMask();
12920 }
12921
12922 if (spellSchoolMask != SPELL_SCHOOL_MASK_NONE)
12923 {
12924 SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
12925 for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
12926 {
12927 SpellInfo const* immuneSpellInfo = sSpellMgr->GetSpellInfo(itr->spellId);
12928 if (((itr->type & spellSchoolMask) == spellSchoolMask)
12929 && (!immuneSpellInfo || immuneSpellInfo->IsPositive()) && !spellInfo->IsPositive()
12930 && !spellInfo->CanPierceImmuneAura(immuneSpellInfo))
12931 {
12932 return true;
12933 }
12934 }
12935 }
12936 }
12937
12938 return false;
12939}
@ IMMUNITY_ALLOW_ID
Definition: SharedDefines.h:1401
@ IMMUNITY_ID
Definition: SharedDefines.h:1400
@ IMMUNITY_MECHANIC
Definition: SharedDefines.h:1399

References SpellInfo::CanPierceImmuneAura(), SpellInfo::Dispel, SpellInfo::Effects, SpellInfo::GetSchoolMask(), Spell::GetSpellSchoolMask(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasAuraType(), SpellInfo::Id, IMMUNITY_ALLOW_ID, IMMUNITY_DISPEL, IMMUNITY_ID, IMMUNITY_MECHANIC, IMMUNITY_SCHOOL, IsImmunedToSpellEffect(), SpellInfo::IsPositive(), m_spellImmune, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_AURA_TRANSFORM, SPELL_SCHOOL_MASK_NONE, and sSpellMgr.

Referenced by AddAura(), Spell::DoSpellHitOnUnit(), Creature::IsImmunedToSpell(), spell_hun_lock_and_load::IsTargetValid(), boss_talon_king_ikiss::JustEngagedWith(), boss_kiggler_the_crazed::JustEngagedWith(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), and SpellHitResult().

◆ IsImmunedToSpellEffect()

bool Unit::IsImmunedToSpellEffect ( SpellInfo const *  spellInfo,
uint32  index 
) const
virtual

Reimplemented in Creature, and Totem.

12942{
12943 if (!spellInfo || !spellInfo->Effects[index].IsEffect())
12944 return false;
12945
12946 // xinef: pet scaling auras
12947 if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
12948 return false;
12949
12951 return false;
12952
12953 //If m_immuneToEffect type contain this effect type, IMMUNE effect.
12954 uint32 effect = spellInfo->Effects[index].Effect;
12955 SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT];
12956 for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr)
12957 {
12958 if (itr->type == effect && (itr->spellId != 62692 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
12959 {
12960 return true;
12961 }
12962 }
12963
12964 if (uint32 mechanic = spellInfo->Effects[index].Mechanic)
12965 {
12966 SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
12967 for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
12968 if (itr->type == mechanic)
12969 return true;
12970 }
12971
12972 if (uint32 aura = spellInfo->Effects[index].ApplyAuraName)
12973 {
12975 for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
12976 {
12977 if (itr->type == aura && (itr->spellId != 64848 || (spellInfo->Effects[index].MiscValue == POWER_MANA && !CanRestoreMana(spellInfo))))
12978 {
12979 if (!spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
12980 {
12981 if (itr->blockType == SPELL_BLOCK_TYPE_ALL || spellInfo->IsPositive()) // xinef: added for pet scaling
12982 {
12983 return true;
12984 }
12985 }
12986 }
12987 }
12988
12989 if (!spellInfo->HasAttribute(SPELL_ATTR2_NO_SCHOOL_IMMUNITIES))
12990 {
12991 // Check for immune to application of harmful magical effects
12993 for (AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
12994 {
12995 if (/*(spellInfo->Dispel == DISPEL_MAGIC || spellInfo->Dispel == DISPEL_CURSE || spellInfo->Dispel == DISPEL_DISEASE) &&*/ // Magic debuff, xinef: all kinds?
12996 ((*iter)->GetMiscValue() & spellInfo->GetSchoolMask()) && // Check school
12997 !spellInfo->IsPositiveEffect(index) && // Harmful
12998 spellInfo->Effects[index].Effect != SPELL_EFFECT_PERSISTENT_AREA_AURA) // Not Persistent area auras
12999 {
13000 return true;
13001 }
13002 }
13003 }
13004 }
13005
13006 return false;
13007}
@ SPELL_BLOCK_TYPE_ALL
Definition: SpellDefines.h:157
@ SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL
Definition: SpellAuraDefines.h:330
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
Definition: SharedDefines.h:805
@ SPELL_ATTR3_ALWAYS_HIT
Definition: SharedDefines.h:511
@ IMMUNITY_STATE
Definition: SharedDefines.h:1395
@ IMMUNITY_EFFECT
Definition: SharedDefines.h:1394
@ SPELL_ATTR4_OWNER_POWER_SCALING
Definition: SharedDefines.h:555
bool CanRestoreMana(SpellInfo const *spellInfo) const
Definition: Unit.cpp:21119

References CanRestoreMana(), SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, SpellInfo::IsPositive(), SpellInfo::IsPositiveEffect(), m_spellImmune, POWER_MANA, SPELL_ATTR0_NO_IMMUNITIES, SPELL_ATTR2_NO_SCHOOL_IMMUNITIES, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_OWNER_POWER_SCALING, SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL, SPELL_AURA_SPIRIT_OF_REDEMPTION, SPELL_BLOCK_TYPE_ALL, and SPELL_EFFECT_PERSISTENT_AREA_AURA.

Referenced by AddAura(), Spell::AddUnitTarget(), Spell::DoSpellHitOnUnit(), spell_dk_death_grip::HandleBaseDummy(), IsImmunedToSpell(), and Creature::IsImmunedToSpellEffect().

◆ IsImmuneToAll()

bool Unit::IsImmuneToAll ( ) const
inline
1023{ return IsImmuneToPC() && IsImmuneToNPC(); }

References IsImmuneToNPC(), and IsImmuneToPC().

◆ IsImmuneToNPC()

◆ IsImmuneToPC()

◆ isInAccessiblePlaceFor()

bool Unit::isInAccessiblePlaceFor ( Creature const *  c) const
4159{
4160 if (c->GetMapId() == 618) // Ring of Valor
4161 {
4162 // skip transport check, check for being below floor level
4163 if (this->GetPositionZ() < 28.0f)
4164 return false;
4165 if (BattlegroundMap* bgMap = c->GetMap()->ToBattlegroundMap())
4166 if (Battleground* bg = bgMap->GetBG())
4167 if (bg->GetStartTime() < 80133) // 60000ms preparation time + 20133ms elevator rise time
4168 return false;
4169 }
4170 else if (c->GetMapId() == 631) // Icecrown Citadel
4171 {
4172 // if static transport doesn't match - return false
4173 if (c->GetTransport() != this->GetTransport() && ((c->GetTransport() && c->GetTransport()->IsStaticTransport()) || (this->GetTransport() && this->GetTransport()->IsStaticTransport())))
4174 return false;
4175
4176 // special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack
4177 if (c->GetOwnerGUID().IsPlayer() && !c->CanFly())
4178 {
4179 if (c->GetTransport() != this->GetTransport())
4180 return false;
4181 if (this->GetTransport())
4182 {
4183 if (c->GetPositionY() < 2033.0f)
4184 {
4185 if (this->GetPositionY() > 2033.0f)
4186 return false;
4187 }
4188 else if (c->GetPositionY() < 2438.0f)
4189 {
4190 if (this->GetPositionY() < 2033.0f || this->GetPositionY() > 2438.0f)
4191 return false;
4192 }
4193 else if (this->GetPositionY() < 2438.0f)
4194 return false;
4195 }
4196 }
4197 }
4198 else
4199 {
4200 // pussywizard: prevent any bugs by passengers exiting transports or normal creatures flying away
4201 if (c->GetTransport() != this->GetTransport())
4202 return false;
4203 }
4204
4205 LiquidStatus liquidStatus = GetLiquidData().Status;
4206 bool isInWater = (liquidStatus & MAP_LIQUID_STATUS_IN_CONTACT) != 0;
4207
4208 // In water or jumping in water
4209 if (isInWater || (liquidStatus == LIQUID_MAP_ABOVE_WATER && (IsFalling() || (ToPlayer() && ToPlayer()->IsFalling()))))
4210 {
4211 return c->CanEnterWater();
4212 }
4213 else
4214 {
4215 return c->CanWalk() || c->CanFly();
4216 }
4217}
LiquidStatus
Definition: Map.h:143
@ LIQUID_MAP_ABOVE_WATER
Definition: Map.h:145
#define MAP_LIQUID_STATUS_IN_CONTACT
Definition: Map.h:152
LiquidData const & GetLiquidData() const
Definition: Object.cpp:3174
bool IsFalling() const
Definition: Unit.cpp:19871
LiquidStatus Status
Definition: Map.h:178
BattlegroundMap * ToBattlegroundMap()
Definition: Map.h:549
Definition: Map.h:853

References Creature::CanEnterWater(), Creature::CanFly(), Creature::CanWalk(), WorldObject::GetLiquidData(), WorldObject::GetMap(), WorldLocation::GetMapId(), GetOwnerGUID(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetTransport(), IsFalling(), ObjectGuid::IsPlayer(), GameObject::IsStaticTransport(), LIQUID_MAP_ABOVE_WATER, MAP_LIQUID_STATUS_IN_CONTACT, LiquidData::Status, Map::ToBattlegroundMap(), and Object::ToPlayer().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), ChaseMovementGenerator< T >::DoUpdate(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), and HostileReference::updateOnlineStatus().

◆ isInBackInMap()

bool Unit::isInBackInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const

◆ IsInCombat()

bool Unit::IsInCombat ( ) const
inline

References HasUnitFlag(), and UNIT_FLAG_IN_COMBAT.

Referenced by _IsValidAttackTarget(), Player::ActivateTaxiPathTo(), npc_anubisath_sentinel::aqsentinelAI::CallBuddiesToAttack(), npc_argent_captainAI::CanAIAttack(), Player::CanEquipItem(), Creature::CanPeriodicallyCallForAssistance(), Player::CanUnequipItem(), spell_hun_disengage::CheckCast(), Spell::CheckCast(), SpellInfo::CheckTarget(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::CheckTombReset(), CombatStart(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DoAction(), boss_the_lich_king::boss_the_lich_kingAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), npc_risen_archmage::npc_risen_archmageAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), UnitAI::DoAddAuraToAllHostilePlayers(), Spell::DoAllEffectOnTarget(), UnitAI::DoCastToAllHostilePlayers(), Spell::DoSpellHitOnUnit(), Spell::EffectActivateRune(), npc_clintar_spirit::npc_clintar_spiritAI::EnterEvadeMode(), boss_professor_putricide::boss_professor_putricideAI::EnterEvadeMode(), gunship_npc_AI::EnterEvadeMode(), npc_gunship_boarding_addAI::EnterEvadeMode(), Player::EquipItem(), CastRunesEvent::Execute(), GetVelocity(), spell_apothecary_lingering_fumes::HandleAfterCast(), WorldSession::HandleBattlefieldLeaveOpcode(), WorldSession::HandleBattleFieldPortOpcode(), spell_mc_play_dead_aura::HandleEffectRemove(), WorldSession::HandleEquipmentSetUse(), boss_malygos::boss_malygosAI::HandleIntroSpeech(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMessagechatOpcode(), WorldSession::HandlePetCastSpellOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), ArenaSpectator::HandleSpectatorSpectateCommand(), spell_putricide_mutated_transformation::HandleSummon(), WorldSession::HandleSummonResponseOpcode(), tele_commandscript::HandleTeleCommand(), misc_commandscript::HandleUnstuckCommand(), WorldSession::HandleUseItemOpcode(), npc_pet_mage_mirror_image::InitializeAI(), IsEngaged(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_anubrekhan::boss_anubrekhanAI::JustSummoned(), boss_kelthuzad::boss_kelthuzadAI::JustSummoned(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), boss_rotface::boss_rotfaceAI::JustSummoned(), boss_nexusprince_shaffar::JustSummoned(), npc_nelson::npc_nelsonAI::JustSummoned(), Pet::LoseHappiness(), CreatureGroup::MemberEvaded(), CreatureAI::MoveInLineOfSight(), boss_eye_of_cthun::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::MoveInLineOfSight(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_kelthuzad::boss_kelthuzadAI::MoveInLineOfSight(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_pet_mage_mirror_image::MySelectNextTarget(), npc_death_knight_initiate::OnGossipHello(), npc_ulduar_expedition_commander::OnGossipHello(), go_ulduar_working_harpoon::OnGossipHello(), npc_death_knight_initiate::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), icecrown_citadel_teleport::OnGossipSelect(), at_frozen_throne_teleport::OnTrigger(), at_naxxramas_hub_portal::OnTrigger(), AreaTrigger_at_voltarus_middle::OnTrigger(), AreaTrigger_at_legion_teleporter::OnTrigger(), RisenArchmageCheck::operator()(), Acore::MostHPMissingInRange::operator()(), Acore::MostHPPercentMissingInRange::operator()(), Acore::FriendlyCCedInRange::operator()(), Acore::FriendlyMissingBuffInRange::operator()(), Acore::AnyAttackableUnitExceptForOriginalCasterInObjectRangeCheck::operator()(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::OwnerAttackedBy(), boss_kologarn::boss_kologarnAI::PassengerBoarded(), SmartScript::ProcessEvent(), Creature::Regenerate(), Player::Regenerate(), Player::RegenerateAll(), Player::RegenerateHealth(), boss_gluth::boss_gluthAI::SelectPlayerInRoom(), instance_naxxramas::instance_naxxramas_InstanceMapScript::SetBossState(), boss_grand_warlock_nethekurse::SetData(), SetInCombatState(), SetSpeed(), boss_prince_keleseth_icc::boss_prince_kelesethAI::SpellHit(), boss_prince_taldaram_icc::boss_prince_taldaramAI::SpellHit(), boss_prince_valanar_icc::boss_prince_valanarAI::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SpellHit(), Spell::SummonGuardian(), lfg::LFGMgr::TeleportPlayer(), Map::Update(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), Creature::Update(), TempSummon::Update(), Update(), DistractMovementGenerator::Update(), TotemAI::UpdateAI(), SimpleCharmedAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_scarlet_courier::npc_scarlet_courierAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_thekal::UpdateAI(), npc_zealot_lorkhan::UpdateAI(), npc_zealot_zath::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), boss_faction_championsAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_moorabi::boss_moorabiAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::UpdateAI(), npc_risen_archmage::npc_risen_archmageAI::UpdateAI(), npc_frost_freeze_trap::npc_frost_freeze_trapAI::UpdateAI(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::UpdateAI(), boss_anubrekhan::boss_anubrekhanAI::UpdateAI(), boss_faerlina::boss_faerlinaAI::UpdateAI(), boss_grobbulus::boss_grobbulusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_hodir::boss_hodirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_pet_mage_mirror_image::UpdateAI(), npc_pet_shaman_earth_elemental::UpdateAI(), npc_pet_shaman_fire_elemental::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), PassiveAI::UpdateAI(), PetAI::UpdateAI(), Player::UpdateContestedPvP(), Creature::UpdateEntry(), boss_bjarngrim::boss_bjarngrimAI::UpdateEscortAI(), InstanceScript::UpdateMinionState(), SmartAI::UpdatePath(), Player::UpdatePotionCooldown(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ IsInCombatWith()

bool Unit::IsInCombatWith ( Unit const *  who) const
20942{
20943 // Check target exists
20944 if (!who)
20945 return false;
20946 // Search in threat list
20947 ObjectGuid guid = who->GetGUID();
20948 for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.GetThreatList().begin(); i != m_ThreatMgr.GetThreatList().end(); ++i)
20949 {
20950 HostileReference* ref = (*i);
20951 // Return true if the unit matches
20952 if (ref && ref->getUnitGuid() == guid)
20953 return true;
20954 }
20955 // Nothing found, false.
20956 return false;
20957}
Definition: ThreatMgr.h:49
ObjectGuid getUnitGuid() const
Definition: ThreatMgr.h:107
ThreatContainer::StorageType const & GetThreatList() const
Definition: ThreatMgr.h:274

References Object::GetGUID(), ThreatMgr::GetThreatList(), HostileReference::getUnitGuid(), and m_ThreatMgr.

Referenced by _IsValidAttackTarget(), DealDamage(), Spell::DoAllEffectOnTarget(), TemporaryThreatModifierEvent::Execute(), spell_herald_volzaj_insanity::HandleDummyEffect(), IsEngagedBy(), and Acore::NearestAttackableUnitInObjectRangeCheck::operator()().

◆ IsInDisallowedMountForm()

bool Unit::IsInDisallowedMountForm ( ) const
21149{
21150 if (SpellInfo const* transformSpellInfo = sSpellMgr->GetSpellInfo(getTransForm()))
21151 {
21152 if (transformSpellInfo->HasAttribute(SPELL_ATTR0_ALLOW_WHILE_MOUNTED))
21153 {
21154 return false;
21155 }
21156 }
21157
21158 if (ShapeshiftForm form = GetShapeshiftForm())
21159 {
21160 SpellShapeshiftFormEntry const* shapeshift = sSpellShapeshiftFormStore.LookupEntry(form);
21161 if (!shapeshift)
21162 {
21163 return true;
21164 }
21165
21166 if (!(shapeshift->flags1 & 0x1))
21167 {
21168 return true;
21169 }
21170 }
21171
21173 {
21174 return false;
21175 }
21176
21177 CreatureDisplayInfoEntry const* display = sCreatureDisplayInfoStore.LookupEntry(GetDisplayId());
21178 if (!display)
21179 {
21180 return true;
21181 }
21182
21184 if (!displayExtra)
21185 {
21186 return true;
21187 }
21188
21189 CreatureModelDataEntry const* model = sCreatureModelDataStore.LookupEntry(display->ModelId);
21190 ChrRacesEntry const* race = sChrRacesStore.LookupEntry(displayExtra->DisplayRaceID);
21191
21192 if (model && !(model->HasFlag(CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT)))
21193 {
21194 if (race && !(race->HasFlag(CHRRACES_FLAGS_CAN_MOUNT)))
21195 {
21196 return true;
21197 }
21198 }
21199
21200 return false;
21201}
@ CHRRACES_FLAGS_CAN_MOUNT
Definition: DBCStructure.h:675
@ CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT
Definition: DBCStructure.h:771
@ SPELL_ATTR0_ALLOW_WHILE_MOUNTED
Definition: SharedDefines.h:406
uint32 getTransForm() const
Definition: Unit.h:1517
bool HasFlag(ChrRacesFlags flag) const
Definition: DBCStructure.h:700
uint32 ExtendedDisplayInfoID
Definition: DBCStructure.h:725
uint32 DisplayRaceID
Definition: DBCStructure.h:741
bool HasFlag(CreatureModelDataFlags flag) const
Definition: DBCStructure.h:804
uint32 flags1
Definition: DBCStructure.h:1822

References CHRRACES_FLAGS_CAN_MOUNT, CREATURE_MODEL_DATA_FLAGS_CAN_MOUNT, CreatureDisplayInfoExtraEntry::DisplayRaceID, CreatureDisplayInfoEntry::ExtendedDisplayInfoID, SpellShapeshiftFormEntry::flags1, GetDisplayId(), GetNativeDisplayId(), GetShapeshiftForm(), getTransForm(), ChrRacesEntry::HasFlag(), CreatureModelDataEntry::HasFlag(), CreatureDisplayInfoEntry::ModelId, sChrRacesStore, sCreatureDisplayInfoExtraStore, sCreatureDisplayInfoStore, sCreatureModelDataStore, SPELL_ATTR0_ALLOW_WHILE_MOUNTED, sSpellMgr, and sSpellShapeshiftFormStore.

Referenced by Player::ActivateTaxiPathTo(), Spell::CheckCast(), Player::ContinueTaxiFlight(), and Player::ProcessDelayedOperations().

◆ IsInFeralForm()

bool Unit::IsInFeralForm ( ) const
inline

◆ IsInFlight()

bool Unit::IsInFlight ( ) const
inline

◆ isInFrontInMap()

bool Unit::isInFrontInMap ( Unit const *  target,
float  distance,
float  arc = M_PI 
) const
4149{
4150 return IsWithinDistInMap(target, distance) && HasInArc(arc, target);
4151}

References Position::HasInArc(), and WorldObject::IsWithinDistInMap().

◆ IsInnkeeper()

bool Unit::IsInnkeeper ( ) const
inline
@ UNIT_NPC_FLAG_INNKEEPER
Definition: UnitDefines.h:310

References HasNpcFlag(), and UNIT_NPC_FLAG_INNKEEPER.

Referenced by npc_innkeeper::OnGossipHello().

◆ IsInPartyWith()

bool Unit::IsInPartyWith ( Unit const *  unit) const
18692{
18693 if (this == unit)
18694 return true;
18695
18696 Unit const* u1 = GetCharmerOrOwnerOrSelf();
18697 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
18698 if (u1 == u2)
18699 return true;
18700
18701 if (u1->IsPlayer() && u2->IsPlayer())
18702 return u1->ToPlayer()->IsInSameGroupWith(u2->ToPlayer());
18703 // Xinef: we assume that npcs with the same faction are in party
18704 else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
18705 return u1->GetFaction() == u2->GetFaction();
18706 // Xinef: creature type_flag should work for party check only if player group is not a raid
18709 return true;
18710 else
18711 return false;
18712}
bool IsInSameGroupWith(Player const *p) const
Definition: Player.cpp:2307
bool isRaidGroup() const
Definition: Group.cpp:2271

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Player::GetGroup(), Object::GetTypeId(), IsControlledByPlayer(), Player::IsInSameGroupWith(), Object::IsPlayer(), Group::isRaidGroup(), Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, and TYPEID_UNIT.

Referenced by SpellInfo::CheckExplicitTarget(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), and Acore::WorldObjectSpellTargetCheck::operator()().

◆ IsInRaidWith()

bool Unit::IsInRaidWith ( Unit const *  unit) const
18715{
18716 if (this == unit)
18717 return true;
18718
18719 Unit const* u1 = GetCharmerOrOwnerOrSelf();
18720 Unit const* u2 = unit->GetCharmerOrOwnerOrSelf();
18721 if (u1 == u2)
18722 return true;
18723
18724 if (u1->IsPlayer() && u2->IsPlayer())
18725 return u1->ToPlayer()->IsInSameRaidWith(u2->ToPlayer());
18726 // Xinef: we assume that npcs with the same faction are in party
18727 else if (u1->GetTypeId() == TYPEID_UNIT && u2->GetTypeId() == TYPEID_UNIT && !u1->IsControlledByPlayer() && !u2->IsControlledByPlayer())
18728 return u1->GetFaction() == u2->GetFaction();
18731 return true;
18732 else
18733 return false;
18734}

References CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT, GetCharmerOrOwnerOrSelf(), Creature::GetCreatureTemplate(), GetFaction(), Object::GetTypeId(), IsControlledByPlayer(), Player::IsInSameRaidWith(), Object::IsPlayer(), Object::ToCreature(), Object::ToPlayer(), CreatureTemplate::type_flags, and TYPEID_UNIT.

Referenced by Corpse::BuildValuesUpdate(), SpellInfo::CheckExplicitTarget(), GetReactionTo(), WorldSession::HandleLootMasterGiveOpcode(), SpellClickInfo::IsFitToRequirements(), Condition::Meets(), Acore::AnyGroupedUnitInObjectRangeCheck::operator()(), Acore::WorldObjectSpellTargetCheck::operator()(), and PatchValuesUpdate().

◆ isInRoots()

bool Unit::isInRoots ( ) const
inline

◆ IsInSanctuary()

bool Unit::IsInSanctuary ( ) const
inline

◆ IsInWater()

bool Unit::IsInWater ( ) const
virtual

◆ IsLevitating()

◆ IsMounted()

◆ IsMovementPreventedByCasting()

bool Unit::IsMovementPreventedByCasting ( ) const
virtual

Reimplemented in Creature.

4125{
4126 // can always move when not casting
4128 {
4129 return false;
4130 }
4131
4132 // channeled spells during channel stage (after the initial cast timer) allow movement with a specific spell attribute
4134 {
4135 if (spell->getState() != SPELL_STATE_FINISHED && spell->IsChannelActive())
4136 {
4137 if (spell->GetSpellInfo()->IsActionAllowedChannel())
4138 {
4139 return false;
4140 }
4141 }
4142 }
4143
4144 // prohibit movement for all other spell casts
4145 return true;
4146}
@ UNIT_STATE_CASTING
Definition: UnitDefines.h:164

References CURRENT_CHANNELED_SPELL, HasUnitState(), m_currentSpells, SPELL_STATE_FINISHED, and UNIT_STATE_CASTING.

Referenced by TimedFleeingMovementGenerator::Update().

◆ isMoving()

◆ IsNeutralToAll()

bool Unit::IsNeutralToAll ( ) const
10202{
10203 FactionTemplateEntry const* my_faction = GetFactionTemplateEntry();
10204 if (!my_faction || !my_faction->faction)
10205 return true;
10206
10207 FactionEntry const* raw_faction = sFactionStore.LookupEntry(my_faction->faction);
10208 if (raw_faction && raw_faction->reputationListID >= 0)
10209 return false;
10210
10211 return my_faction->IsNeutralToAll();
10212}
bool IsNeutralToAll() const
Definition: DBCStructure.h:982

References FactionTemplateEntry::faction, GetFactionTemplateEntry(), FactionTemplateEntry::IsNeutralToAll(), FactionEntry::reputationListID, and sFactionStore.

Referenced by Creature::_IsTargetAcceptable(), Creature::CanStartAttack(), AggressorAI::Permissible(), and ReactorAI::Permissible().

◆ IsNonMeleeSpellCast()

bool Unit::IsNonMeleeSpellCast ( bool  withDelayed,
bool  skipChanneled = false,
bool  skipAutorepeat = false,
bool  isAutoshoot = false,
bool  skipInstant = true 
) const
4065{
4066 // We don't do loop here to explicitly show that melee spell is excluded.
4067 // Maybe later some special spells will be excluded too.
4068
4069 // generic spells are cast when they are not finished and not delayed
4072 (withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED))
4073 {
4074 if (!skipInstant || m_currentSpells[CURRENT_GENERIC_SPELL]->GetCastTime())
4075 {
4076 if (!isAutoshoot || !m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4077 return true;
4078 }
4079 }
4080 // channeled spells may be delayed, but they are still considered cast
4081 if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
4083 {
4084 if (!isAutoshoot || !m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
4085 return true;
4086 }
4087 // autorepeat spells may be finished or delayed, but they are still considered cast
4088 if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
4089 return true;
4090
4091 return false;
4092}
@ SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS
Definition: SharedDefines.h:473

References CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, m_currentSpells, SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_DELAYED, and SPELL_STATE_FINISHED.

Referenced by Spell::_cast(), _UpdateAutoRepeatSpell(), Player::ActivateSpec(), Player::ActivateTaxiPathTo(), Player::CanEquipItem(), CombatStop(), npc_mograine::npc_mograineAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), ScriptedAI::DoCastSpell(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), Spell::EffectKnockBack(), Spell::finish(), WorldSession::HandleCancelCastOpcode(), WorldSession::HandleSetRaidDifficultyOpcode(), isSpellBlocked(), boss_shade_of_aran::JustEngagedWith(), boss_pandemonius::JustEngagedWith(), MeleeSpellHitResult(), Spell::prepare(), SmartScript::ProcessEvent(), RollMeleeOutcomeAgainst(), spell_item_fetch_ball::SelectTarget(), setDeathState(), StopAttackFaction(), boss_netherspite::SwitchToPortalPhase(), Player::TeleportTo(), TotemAI::UpdateAI(), npc_chesspiece::UpdateAI(), boss_high_inquisitor_whitemane::boss_high_inquisitor_whitemaneAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_warmage_violetstand::UpdateAI(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ IsOnVehicle()

◆ IsPet()

bool Unit::IsPet ( ) const
inline
754{ return m_unitTypeMask & UNIT_MASK_PET; }
@ UNIT_MASK_PET
Definition: UnitDefines.h:139

References m_unitTypeMask, and UNIT_MASK_PET.

Referenced by Spell::_cast(), Spell::AddUnitTarget(), spell_warl_demonic_pact_aura::AfterCheckProc(), Creature::AllLootRemovedFromCorpse(), BeforeVisibilityDestroy< Creature >(), Creature::CallAssistance(), Creature::CallForHelp(), boss_renataki::boss_renatakiAI::CanAlwaysBeDetectable(), boss_renataki::boss_renatakiAI::CanSeeAlways(), Creature::CanSwim(), ClearInCombat(), CombatStart(), Creature::CreateFromProto(), Player::CreatePet(), DealDamage(), MotionTransport::DelayedTeleportTransport(), PetAI::DoAttack(), ChaseMovementGenerator< T >::DoUpdate(), Spell::EffectDismissPet(), Spell::EffectForceDeselect(), Spell::EffectRenamePet(), Spell::EffectSanctuary(), Spell::EffectSchoolDMG(), Spell::EffectTameCreature(), Acore::XP::Gain(), Creature::GetAggroRange(), GetCastingTimeForBonus(), GetCombatRatingReduction(), GetCreatePowers(), GetNextRandomRaidMemberOrPet(), GetRandomContactPoint(), GetVelocity(), AuraEffect::HandleAuraModResistance(), AuraEffect::HandleAuraModStat(), debug_commandscript::HandleDebugThreatListCommand(), AuraEffect::HandleFeignDeath(), modify_commandscript::HandleModifyTalentCommand(), AuraEffect::HandleModPossessPet(), AuraEffect::HandleModResistancePercent(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcDeleteCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_commandscript::HandleNpcSetModelCommand(), npc_commandscript::HandleNpcSetMoveTypeCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), npc_commandscript::HandleNpcTameCommand(), WorldSession::HandlePetAbandon(), WorldSession::HandlePetActionHelper(), WorldSession::HandlePetCastSpellOpcode(), pet_commandscript::HandlePetCreateCommand(), WorldSession::HandlePetRename(), WorldSession::HandlePetSetAction(), misc_commandscript::HandleRespawnCommand(), Creature::InitEntry(), TempSummon::InitStats(), Guardian::InitStatsForLevel(), DisableMgr::IsDisabledFor(), Creature::isElite(), Minion::IsGuardianPet(), Player::isHonorOrXPTarget(), Creature::isWorldBoss(), npc_webbed_creature::npc_webbed_creatureAI::JustDied(), npc_underbat::JustEngagedWith(), npc_hivezara_stinger::JustEngagedWith(), npc_vekniss_stinger::JustEngagedWith(), boss_murmur::JustEngagedWith(), Kill(), spell_hun_target_self_and_pet::Load(), ModSpellCastTime(), CreatureAI::MoveBackwardsChecks(), CreatureAI::MoveCircleChecks(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::MoveInLineOfSight(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::MoveInLineOfSight(), Acore::MostHPMissingGroupInRange::operator()(), PetAI::ReceiveEmote(), RollMeleeOutcomeAgainst(), FactorySelector::SelectAI(), Creature::SelectLevel(), WorldSession::SendPetNameQuery(), Spell::SendSpellGo(), Spell::SendSpellStart(), SetCharm(), Creature::SetDisplayId(), SetHealth(), SetInCombatState(), SetMinion(), Creature::SetObjectScale(), setPowerType(), SpellDamageBonusDone(), SpellPctDamageModsDone(), ToPet(), TempSummon::UnSummon(), Update(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_hazzarah::UpdateAI(), PetAI::UpdateAI(), Player::UpdateAreaDependentAuras(), UpdateAuraForGroup(), Creature::UpdateEntry(), Creature::UpdateMoveInLineOfSightState(), and UpdateSpeed().

◆ IsPetAura()

bool Unit::IsPetAura ( Aura const *  aura)
17254{
17255 Unit* owner = GetOwner();
17256
17257 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
17258 return false;
17259
17260 // if the owner has that pet aura, return true
17261 for (PetAura const* petAura : owner->m_petAuras)
17262 if (petAura->GetAura(GetEntry()) == aura->GetId())
17263 return true;
17264
17265 return false;
17266}
Definition: SpellMgr.h:470
uint32 GetAura(uint32 petEntry) const
Definition: SpellMgr.h:486

References PetAura::GetAura(), Object::GetEntry(), Aura::GetId(), GetOwner(), Object::GetTypeId(), m_petAuras, and TYPEID_PLAYER.

Referenced by Pet::_SaveAuras(), and Spell::EffectSummonPet().

◆ IsPetInCombat()

bool Unit::IsPetInCombat ( ) const
inline

◆ IsPolymorphed()

bool Unit::IsPolymorphed ( ) const
16670{
16671 uint32 transformId = getTransForm();
16672 if (!transformId)
16673 return false;
16674
16675 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(transformId);
16676 if (!spellInfo)
16677 return false;
16678
16679 return spellInfo->GetSpellSpecific() == SPELL_SPECIFIC_MAGE_POLYMORPH;
16680}
@ SPELL_SPECIFIC_MAGE_POLYMORPH
Definition: SpellInfo.h:160
SpellSpecificType GetSpellSpecific() const
Definition: SpellInfo.cpp:2136

References SpellInfo::GetSpellSpecific(), getTransForm(), SPELL_SPECIFIC_MAGE_POLYMORPH, and sSpellMgr.

Referenced by Attack(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), Player::RegenerateAll(), Creature::RegenerateHealth(), Player::RegenerateHealth(), and Creature::Update().

◆ isPossessed()

◆ isPossessedByPlayer()

bool Unit::isPossessedByPlayer ( ) const
inline

◆ isPossessing() [1/2]

bool Unit::isPossessing ( ) const
inline
1218 {
1219 if (Unit* u = GetCharm())
1220 return u->isPossessed();
1221 else
1222 return false;
1223 }

References GetCharm().

Referenced by WorldSession::HandleCastSpellOpcode(), and misc_commandscript::HandleUnbindSightCommand().

◆ isPossessing() [2/2]

bool Unit::isPossessing ( Unit u) const
inline
1224{ return u->isPossessed() && GetCharmGUID() == u->GetGUID(); }
bool isPossessed() const
Definition: Unit.h:1215

References GetCharmGUID(), Object::GetGUID(), and isPossessed().

◆ IsPvP()

◆ IsQuestGiver()

bool Unit::IsQuestGiver ( ) const
inline
@ UNIT_NPC_FLAG_QUESTGIVER
Definition: UnitDefines.h:295

References HasNpcFlag(), and UNIT_NPC_FLAG_QUESTGIVER.

Referenced by npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_lokhtos_darkbargainer::OnGossipHello(), npc_highlord_darion_mograine::OnGossipHello(), npc_augustus_the_touched::OnGossipHello(), npc_parqual_fintallas::OnGossipHello(), npc_varian_wrynn::OnGossipHello(), npc_thrall_bfu::OnGossipHello(), npc_cos_chromie_middle::OnGossipHello(), npcs_riverbreeze_and_silversky::OnGossipHello(), npc_thrall_warchief::OnGossipHello(), npc_braug_dimspirit::OnGossipHello(), npc_steward_of_time::OnGossipHello(), npc_stone_watcher_of_norgannon::OnGossipHello(), npc_rivern_frostwind::OnGossipHello(), npc_fos_leader::OnGossipHello(), npc_hor_leader::OnGossipHello(), npc_oculus_drakegiver::OnGossipHello(), npc_shandy_dalaran::OnGossipHello(), npc_razael_and_lyana::OnGossipHello(), npc_mcmanus::OnGossipHello(), npc_vekjik::OnGossipHello(), npc_avatar_of_freya::OnGossipHello(), npc_roxi_ramrocket::OnGossipHello(), npc_wg_demolisher_engineer::OnGossipHello(), npc_wg_spirit_guide::OnGossipHello(), npc_wg_queue::OnGossipHello(), npc_wg_quest_giver::OnGossipHello(), npc_finklestein::OnGossipHello(), npc_captain_saeed::OnGossipHello(), npc_innkeeper::OnGossipHello(), npc_prof_alchemy::OnGossipHello(), npc_prof_blacksmith::OnGossipHello(), npc_prof_leather::OnGossipHello(), npc_prof_tailor::OnGossipHello(), npc_taxi::OnGossipHello(), npc_riggle_bassbait::OnGossipHello(), and npc_sayge::OnGossipHello().

◆ IsScriptOverriden()

AuraEffect * Unit::IsScriptOverriden ( SpellInfo const *  spell,
int32  script 
) const
5761{
5763 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
5764 {
5765 if ((*i)->GetMiscValue() == script)
5766 if ((*i)->IsAffectedOnSpell(spell))
5767 return (*i);
5768 }
5769 return nullptr;
5770}
@ SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
Definition: SpellAuraDefines.h:175

References GetAuraEffectsByType(), and SPELL_AURA_OVERRIDE_CLASS_SCRIPTS.

Referenced by Spell::CheckCast(), Spell::EffectWeaponDmg(), and AuraEffect::HandleAuraModShapeshift().

◆ IsServiceProvider()

bool Unit::IsServiceProvider ( ) const
inline

◆ IsSitState()

bool Unit::IsSitState ( ) const
16640{
16641 uint8 s = getStandState();
16642 return
16646}
@ UNIT_STAND_STATE_SIT_HIGH_CHAIR
Definition: UnitDefines.h:38
@ UNIT_STAND_STATE_SIT_MEDIUM_CHAIR
Definition: UnitDefines.h:37
@ UNIT_STAND_STATE_SIT_LOW_CHAIR
Definition: UnitDefines.h:36
@ UNIT_STAND_STATE_SIT_CHAIR
Definition: UnitDefines.h:34

References getStandState(), UNIT_STAND_STATE_SIT, UNIT_STAND_STATE_SIT_CHAIR, UNIT_STAND_STATE_SIT_HIGH_CHAIR, UNIT_STAND_STATE_SIT_LOW_CHAIR, and UNIT_STAND_STATE_SIT_MEDIUM_CHAIR.

Referenced by _ApplyAura(), AttackerStateUpdate(), WorldSession::HandleMovementOpcodes(), IsStandState(), Spell::prepare(), and SpellTakenCritChance().

◆ isSpellBlocked()

bool Unit::isSpellBlocked ( Unit victim,
SpellInfo const *  spellProto,
WeaponAttackType  attackType = BASE_ATTACK 
)
3068{
3069 // These spells can't be blocked
3070 if (spellProto && spellProto->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3071 return false;
3072
3073 if (victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION) || victim->HasInArc(M_PI, this))
3074 {
3075 // Check creatures flags_extra for disable block
3076 if (victim->GetTypeId() == TYPEID_UNIT &&
3078 return false;
3079
3080 float blockChance = victim->GetUnitBlockChance();
3081 blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
3082
3083 // xinef: cant block while casting or while stunned
3084 if (blockChance < 0.0f || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3085 blockChance = 0.0f;
3086
3087 if (roll_chance_f(blockChance))
3088 return true;
3089 }
3090 return false;
3091}
@ SPELL_AURA_IGNORE_HIT_DIRECTION
Definition: SpellAuraDefines.h:351
@ CREATURE_FLAG_EXTRA_NO_BLOCK
Definition: CreatureData.h:50
@ UNIT_STATE_CONTROLLED
Definition: UnitDefines.h:190
@ SPELL_ATTR0_NO_ACTIVE_DEFENSE
Definition: SharedDefines.h:403
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const *target=nullptr) const
Definition: Unit.cpp:3757
float GetUnitBlockChance() const
Definition: Unit.cpp:3669

References CREATURE_FLAG_EXTRA_NO_BLOCK, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetMaxSkillValueForLevel(), Object::GetTypeId(), GetUnitBlockChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasAuraType(), Position::HasInArc(), HasUnitState(), IsNonMeleeSpellCast(), roll_chance_f(), SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_AURA_IGNORE_HIT_DIRECTION, Object::ToCreature(), TYPEID_UNIT, and UNIT_STATE_CONTROLLED.

Referenced by CalculateSpellDamageTaken().

◆ IsSpiritGuide()

bool Unit::IsSpiritGuide ( ) const
inline

◆ IsSpiritHealer()

bool Unit::IsSpiritHealer ( ) const
inline

◆ IsSpiritService()

◆ IsStandState()

◆ IsStopped()

bool Unit::IsStopped ( ) const
inline

◆ IsSummon()

bool Unit::IsSummon ( ) const
inline
@ UNIT_MASK_SUMMON
Definition: UnitDefines.h:135

References m_unitTypeMask, and UNIT_MASK_SUMMON.

Referenced by Creature::CanPeriodicallyCallForAssistance(), spell_item_unsated_craving::CheckProc(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Spell::EffectScriptEffect(), boss_skeram::EnterEvadeMode(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), Spell::finish(), GetAllMinionsByEntry(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pri_lightwell::HandleScriptEffect(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), boss_skeram::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), boss_freya_iron_root::boss_freya_iron_rootAI::JustDied(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::JustDied(), npc_counselor_talbot::npc_counselor_talbotAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::npc_pet_dk_ghoulAI::JustDied(), npc_pet_pri_shadowfiend::JustDied(), boss_skeram::JustEngagedWith(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_leryssa::npc_leryssaAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), BattlefieldWG::OnCreatureCreate(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnCreatureCreate(), instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), instance_blackfathom_deeps::instance_blackfathom_deeps_InstanceMapScript::OnUnitDeath(), RemoveAllControlled(), RemoveAllMinionsByEntry(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), Creature::SaveRespawnTime(), Creature::SearchFormation(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), ToTempSummon(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), boss_skeram::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), and Player::VehicleSpellInitialize().

◆ isSwimming()

◆ IsTabardDesigner()

bool Unit::IsTabardDesigner ( ) const
inline

◆ isTargetableForAttack()

bool Unit::isTargetableForAttack ( bool  checkFakeDeath = true,
Unit const *  byWho = nullptr 
) const
13784{
13785 if (!IsAlive())
13786 return false;
13787
13789 return false;
13790
13791 if (IsImmuneToPC() && byWho && byWho->GetCharmerOrOwnerPlayerOrPlayerItself())
13792 return false;
13793
13794 if (IsPlayer() && ToPlayer()->IsGameMaster())
13795 return false;
13796
13797 return !HasUnitState(UNIT_STATE_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STATE_DIED));
13798}
@ UNIT_STATE_DIED
Definition: UnitDefines.h:149

References GetCharmerOrOwnerPlayerOrPlayerItself(), HasUnitFlag(), HasUnitState(), IsAlive(), IsImmuneToPC(), Object::IsPlayer(), Object::ToPlayer(), UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_NOT_SELECTABLE, UNIT_STATE_DIED, and UNIT_STATE_UNATTACKABLE.

Referenced by Creature::_IsTargetAcceptable(), boss_shade_of_aran::AttackStart(), boss_alyson_antille::boss_alyson_antilleAI::AttackStart(), boss_gazakrothAI::AttackStart(), boss_slither::boss_slitherAI::AttackStart(), boss_veklor::AttackStart(), npc_capernian::AttackStart(), Player::IsImmuneToEnvironmentalDamage(), FollowerAI::MoveInLineOfSight(), npc_escortAI::MoveInLineOfSight(), npc_pet_hunter_snake_trap::MoveInLineOfSight(), Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestAttackableUnitInObjectRangeCheck::operator()(), NecroticPlagueTargetCheck::operator()(), TotemAI::UpdateAI(), and boss_zuljin::boss_zuljinAI::UpdateAI().

◆ IsTaxi()

bool Unit::IsTaxi ( ) const
inline

◆ IsTotem()

◆ IsTrainer()

◆ IsTriggeredAtSpellProcEvent()

bool Unit::IsTriggeredAtSpellProcEvent ( Unit victim,
Aura aura,
WeaponAttackType  attType,
bool  isVictim,
bool  active,
SpellProcEventEntry const *&  spellProcEvent,
ProcEventInfo const &  eventInfo 
)
private
17341{
17342 SpellInfo const* spellProto = aura->GetSpellInfo();
17343 SpellInfo const* procSpell = eventInfo.GetSpellInfo();
17344
17345 // let the aura be handled by new proc system if it has new entry
17346 if (sSpellMgr->GetSpellProcEntry(spellProto->Id))
17347 return false;
17348
17349 // Get proc Event Entry
17350 spellProcEvent = sSpellMgr->GetSpellProcEvent(spellProto->Id);
17351
17352 // Get EventProcFlag
17353 uint32 EventProcFlag;
17354 if (spellProcEvent && spellProcEvent->procFlags) // if exist get custom spellProcEvent->procFlags
17355 EventProcFlag = spellProcEvent->procFlags;
17356 else
17357 EventProcFlag = spellProto->ProcFlags; // else get from spell proto
17358 // Continue if no trigger exist
17359 if (!EventProcFlag)
17360 return false;
17361
17362 // Additional checks for triggered spells (ignore trap casts)
17363 //if (procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION))
17364 //{
17365 // if (!spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_TRIGGERED))
17366 // return false;
17367 //}
17368
17369 // Xinef: additional check for player auras - only player spells can trigger player proc auras
17370 // Xinef: skip victim auras
17371 // Excluded player shoot spells
17372 // Excluded player item spells
17373 if (!isVictim && IsPlayer() && !(EventProcFlag & (PROC_FLAG_KILL | PROC_FLAG_DEATH)))
17374 {
17375 if (procSpell && procSpell->SpellFamilyName == SPELLFAMILY_GENERIC && procSpell->GetCategory() != 76 &&
17376 (!eventInfo.GetProcSpell() || !eventInfo.GetProcSpell()->m_CastItem) &&
17377 (!eventInfo.GetTriggerAuraSpell() || eventInfo.GetTriggerAuraSpell()->SpellFamilyName == SPELLFAMILY_GENERIC))
17378 {
17379 return false;
17380 }
17381 }
17382
17383 // Check spellProcEvent data requirements
17384 if (!sSpellMgr->IsSpellProcEventCanTriggeredBy(spellProto, spellProcEvent, EventProcFlag, eventInfo, active))
17385 return false;
17386 // In most cases req get honor or XP from kill
17387 if (EventProcFlag & PROC_FLAG_KILL && IsPlayer())
17388 {
17389 bool allow = false;
17390
17391 if (victim)
17392 allow = ToPlayer()->isHonorOrXPTarget(victim);
17393
17394 // Shadow Word: Death - can trigger from every kill
17395 if (aura->GetId() == 32409 || aura->GetId() == 18372 || aura->GetId() == 18213)
17396 allow = true;
17397 if (!allow)
17398 return false;
17399 }
17400 // Aura added by spell can`t trigger from self (prevent drop charges/do triggers)
17401 // But except periodic and kill triggers (can triggered from self)
17402 if (procSpell && procSpell->Id == spellProto->Id
17403 && !(spellProto->ProcFlags & (PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_KILL)))
17404 return false;
17405
17406 // Check if current equipment allows aura to proc
17407 if (!isVictim && IsPlayer() && !spellProto->HasAttribute(SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT))
17408 {
17409 Player* player = ToPlayer();
17410 if (spellProto->EquippedItemClass == ITEM_CLASS_WEAPON)
17411 {
17412 Item* item = nullptr;
17413 if (attType == BASE_ATTACK)
17415 else if (attType == OFF_ATTACK)
17417 else
17419
17420 if (player->IsInFeralForm())
17421 return false;
17422
17423 if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
17424 return false;
17425 }
17426 else if (spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
17427 {
17428 // Check if player is wearing shield
17430 if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
17431 return false;
17432 }
17433 }
17434 // Get chance from spell
17435 float chance = float(spellProto->ProcChance);
17436 // If in spellProcEvent exist custom chance, chance = spellProcEvent->customChance;
17437 if (spellProcEvent && spellProcEvent->customChance)
17438 chance = spellProcEvent->customChance;
17439 // If PPM exist calculate chance from PPM
17440 if (spellProcEvent && spellProcEvent->ppmRate != 0)
17441 {
17442 if (!isVictim)
17443 {
17444 uint32 WeaponSpeed = GetAttackTime(attType);
17445 chance = GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
17446 }
17447 else if (victim)
17448 {
17449 uint32 WeaponSpeed = victim->GetAttackTime(attType);
17450 chance = victim->GetPPMProcChance(WeaponSpeed, spellProcEvent->ppmRate, spellProto);
17451 }
17452 }
17453
17454 // Custom chances
17455 switch (spellProto->SpellFamilyName)
17456 {
17458 {
17459 // Recklessness, allow to proc only once for whirlwind
17460 if (spellProto->Id == 1719 && procSpell && procSpell->Id == 44949)
17461 return false;
17462 }
17463 }
17464
17465 if (eventInfo.GetProcChance())
17466 {
17467 chance = *eventInfo.GetProcChance();
17468 }
17469
17470 // Apply chance modifer aura
17471 if (Player* modOwner = GetSpellModOwner())
17472 {
17473 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CHANCE_OF_SUCCESS, chance);
17474 }
17475
17476 return roll_chance_f(chance);
17477}
@ PROC_FLAG_DEATH
Definition: SpellMgr.h:143
@ PROC_FLAG_TAKEN_PERIODIC
Definition: SpellMgr.h:135
@ PROC_FLAG_KILL
Definition: SpellMgr.h:108
@ SPELLMOD_CHANCE_OF_SUCCESS
Definition: SpellDefines.h:95
@ ITEM_CLASS_ARMOR
Definition: ItemTemplate.h:295
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:293
@ EQUIPMENT_SLOT_RANGED
Definition: Player.h:692
@ SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT
Definition: SharedDefines.h:494
uint32 Class
Definition: ItemTemplate.h:621
uint32 SubClass
Definition: ItemTemplate.h:622
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition: Player.h:1243
bool isHonorOrXPTarget(Unit *victim) const
Definition: Player.cpp:12613
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, SpellInfo const *spellProto) const
Definition: Unit.cpp:13386
uint32 GetCategory() const
Definition: SpellInfo.cpp:870
int32 EquippedItemClass
Definition: SpellInfo.h:375
uint32 ProcFlags
Definition: SpellInfo.h:355
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:376

References BASE_ATTACK, ItemTemplate::Class, SpellProcEventEntry::customChance, EQUIPMENT_SLOT_MAINHAND, EQUIPMENT_SLOT_OFFHAND, EQUIPMENT_SLOT_RANGED, SpellInfo::EquippedItemClass, SpellInfo::EquippedItemSubClassMask, GetAttackTime(), SpellInfo::GetCategory(), Aura::GetId(), GetPPMProcChance(), ProcEventInfo::GetProcChance(), ProcEventInfo::GetProcSpell(), ProcEventInfo::GetSpellInfo(), Aura::GetSpellInfo(), GetSpellModOwner(), Item::GetTemplate(), ProcEventInfo::GetTriggerAuraSpell(), Player::GetUseableItemByPos(), SpellInfo::HasAttribute(), SpellInfo::Id, INVENTORY_SLOT_BAG_0, Item::IsBroken(), Player::isHonorOrXPTarget(), IsInFeralForm(), Object::IsPlayer(), ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON, Spell::m_CastItem, OFF_ATTACK, SpellProcEventEntry::ppmRate, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_TAKEN_PERIODIC, SpellInfo::ProcChance, SpellInfo::ProcFlags, SpellProcEventEntry::procFlags, roll_chance_f(), SPELL_ATTR3_NO_PROC_EQUIP_REQUIREMENT, SPELLFAMILY_GENERIC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyName, SPELLMOD_CHANCE_OF_SUCCESS, sSpellMgr, ItemTemplate::SubClass, and Object::ToPlayer().

Referenced by ProcDamageAndSpellFor().

◆ isTurning()

bool Unit::isTurning ( ) const
inline

◆ IsUnderLastManaUseEffect()

bool Unit::IsUnderLastManaUseEffect ( ) const

◆ IsUnderWater()

bool Unit::IsUnderWater ( ) const
virtual
4310{
4312}
@ LIQUID_MAP_UNDER_WATER
Definition: Map.h:148

References WorldObject::GetLiquidData(), LIQUID_MAP_UNDER_WATER, and LiquidData::Status.

Referenced by Creature::setDeathState().

◆ IsValidAssistTarget()

bool Unit::IsValidAssistTarget ( Unit const *  target) const
13924{
13925 return _IsValidAssistTarget(target, nullptr);
13926}
bool _IsValidAssistTarget(Unit const *target, SpellInfo const *bySpell) const
Definition: Unit.cpp:13929

References _IsValidAssistTarget().

Referenced by SmartAI::AssistPlayerInCombatAgainst().

◆ IsValidAttackTarget()

bool Unit::IsValidAttackTarget ( Unit const *  target,
SpellInfo const *  bySpell = nullptr 
) const
13801{
13802 return _IsValidAttackTarget(target, bySpell);
13803}

References _IsValidAttackTarget().

Referenced by npc_escortAI::AssistPlayerInCombatAgainst(), Creature::CanCreatureAttack(), spell_pal_holy_shock::CheckCast(), spell_pri_penance::CheckCast(), CreatureGroup::GetNewTargetForMember(), WorldSession::HandleAttackSwingOpcode(), npc_beryl_sorcerer::npc_beryl_sorcererAI::JustEngagedWith(), CreatureGroup::MemberEngagingTarget(), npc_icc_vengeful_fleshreaper::npc_icc_vengeful_fleshreaperAI::MoveInLineOfSight(), boss_doomwalker::MoveInLineOfSight(), npc_air_force_bots::npc_air_force_botsAI::MoveInLineOfSight(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::MySelectNextTarget(), Acore::NearestAttackableNoTotemUnitInObjectRangeCheck::operator()(), Acore::NearestHostileUnitCheck::operator()(), MalleableGooSelector::operator()(), Acore::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck::operator()(), SelectNearbyNoTotemTarget(), SelectNearbyTarget(), CreatureAI::SetGazeOn(), StopAttackingInvalidTarget(), SimpleCharmedAI::UpdateAI(), npc_anubarak_spike::npc_anubarak_spikeAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI(), npc_putricide_oozeAI::UpdateAI(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_four_horsemen::boss_four_horsemenAI::UpdateAI(), PossessedAI::UpdateAI(), Player::UpdateCharmedAI(), Player::UpdateFFAPvPFlag(), and Player::UpdateFFAPvPState().

◆ IsVehicle()

◆ IsVendor()

◆ IsVisible()

bool Unit::IsVisible ( ) const
inline
@ SERVERSIDE_VISIBILITY_GM
Definition: SharedDefines.h:1273
@ SEC_PLAYER
Definition: Common.h:56
T_VALUES GetValue(FLAG_TYPE flag) const
Definition: Object.h:369

References FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::GetValue(), WorldObject::m_serverSideVisibility, SEC_PLAYER, and SERVERSIDE_VISIBILITY_GM.

Referenced by npc_ghostly_priest::npc_ghostly_priestAI::AttackStart(), npc_phantom_mage::npc_phantom_mageAI::AttackStart(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::AttackStart(), npc_spectral_footman::npc_spectral_footmanAI::AttackStart(), npc_tortured_rifleman::npc_tortured_riflemanAI::AttackStart(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::CanAIAttack(), boss_professor_putricide::boss_professor_putricideAI::CanAIAttack(), boss_sindragosa::boss_sindragosaAI::CanAIAttack(), boss_the_lich_king::boss_the_lich_kingAI::CanAIAttack(), SpellInfo::CheckTarget(), AuraEffect::HandlePhase(), Player::IsVisibleGloballyFor(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_sindragosa::boss_sindragosaAI::JustEngagedWith(), Acore::AllFriendlyCreaturesInGrid::operator()(), boss_sapphiron::boss_sapphironAI::Reset(), npc_pos_leader::npc_pos_leaderAI::SetData(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_taldaram::UpdateAI(), npc_big_ooze::npc_big_oozeAI::UpdateAI(), and boss_vazruden_the_herald::UpdateAI().

◆ IsWalking()

◆ IsWithinCombatRange()

bool Unit::IsWithinCombatRange ( Unit const *  obj,
float  dist2compare 
) const

◆ IsWithinMeleeRange()

bool Unit::IsWithinMeleeRange ( Unit const *  obj,
float  dist = 0.f 
) const
666{
667 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
668 return false;
669
670 float dx = GetPositionX() - obj->GetPositionX();
671 float dy = GetPositionY() - obj->GetPositionY();
672 float dz = GetPositionZ() - obj->GetPositionZ();
673 float distsq = dx * dx + dy * dy + dz * dz;
674
675 float maxdist = dist + GetMeleeRange(obj);
676
677 return distsq < maxdist * maxdist;
678}

References GetMeleeRange(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_marli::_chargePlayer(), boss_swamplord_muselek::AttackStart(), SmartAI::AttackStart(), boss_ragnaros::boss_ragnarosAI::CanAIAttack(), boss_ouro::CanAIAttack(), boss_murmur::CanAIAttack(), boss_alar::CanAIAttack(), PetAI::CanAttack(), Spell::CheckRange(), UnitAI::DoMeleeAttackIfReady(), boss_zuljin::boss_zuljinAI::DoMeleeAttackIfReady(), boss_mandokir::boss_mandokirAI::DoMeleeAttackIfReady(), boss_ambassador_hellmaw::DoMeleeAttackIfReady(), spell_shazzrah_gate_dummy::FilterTargets(), boss_supremus::FindHatefulStrikeTarget(), boss_ouro::IsPlayerWithinMeleeRange(), boss_ragnaros::boss_ragnarosAI::IsVictimWithinMeleeRange(), boss_swamplord_muselek::JustEngagedWith(), boss_vem::JustEngagedWith(), CreatureAI::MoveCircleChecks(), boss_twin_valkyrAI::myDoMeleeAttackIfReady(), SpellTargetSelector::operator()(), ThreatContainer::SelectNextVictim(), boss_murmur::ShouldCastResonance(), boss_quartermaster_zigris::SpellHitTarget(), Player::Update(), boss_quartermaster_zigris::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), boss_skeram::UpdateAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), boss_marwyn::boss_marwynAI::UpdateAI(), npc_hor_lumbering_abomination::npc_hor_lumbering_abominationAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_darnavan::npc_darnavanAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_blazing_skeleton::npc_blazing_skeletonAI::UpdateAI(), boss_gluth::boss_gluthAI::UpdateAI(), boss_patchwerk::boss_patchwerkAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), npc_ulduar_dark_rune_guardian::npc_ulduar_dark_rune_guardianAI::UpdateAI(), npc_ulduar_dark_rune_sentinel::npc_ulduar_dark_rune_sentinelAI::UpdateAI(), boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), boss_lady_vashj::UpdateAI(), boss_the_lurker_below::UpdateAI(), boss_omor_the_unscarred::UpdateAI(), PetAI::UpdateAI(), npc_zuljin_vortex::npc_zuljin_vortexAI::UpdateAI(), npc_suppresser::npc_suppresserAI::UpdateAI(), and boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::UpdateAI().

◆ IsWithinRange()

bool Unit::IsWithinRange ( Unit const *  obj,
float  dist 
) const
687{
688 if (!obj || !IsInMap(obj) || !InSamePhase(obj))
689 {
690 return false;
691 }
692
693 auto dx = GetPositionX() - obj->GetPositionX();
694 auto dy = GetPositionY() - obj->GetPositionY();
695 auto dz = GetPositionZ() - obj->GetPositionZ();
696 auto distsq = dx * dx + dy * dy + dz * dz;
697
698 return distsq <= dist * dist;
699}

References Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::InSamePhase(), and WorldObject::IsInMap().

Referenced by boss_swamplord_muselek::CanShootVictim().

◆ JumpTo() [1/2]

void Unit::JumpTo ( float  speedXY,
float  speedZ,
bool  forward = true 
)
19432{
19433 float angle = forward ? 0 : M_PI;
19434 if (GetTypeId() == TYPEID_UNIT)
19435 GetMotionMaster()->MoveJumpTo(angle, speedXY, speedZ);
19436 else
19437 {
19438 float vcos = cos(angle + GetOrientation());
19439 float vsin = std::sin(angle + GetOrientation());
19440
19441 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
19442 data << GetPackGUID();
19443 data << uint32(0); // Sequence
19444 data << float(vcos); // x direction
19445 data << float(vsin); // y direction
19446 data << float(speedXY); // Horizontal speed
19447 data << float(-speedZ); // Z Movement speed (vertical)
19448
19449 ToPlayer()->GetSession()->SendPacket(&data);
19450 }
19451}
@ SMSG_MOVE_KNOCK_BACK
Definition: Opcodes.h:269
WorldSession * GetSession() const
Definition: Player.h:1974
void MoveJumpTo(float angle, float speedXY, float speedZ)
The unit will jump in a specific direction.
Definition: MotionMaster.cpp:584
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
Definition: WorldSession.cpp:214

References GetMotionMaster(), Position::GetOrientation(), Object::GetPackGUID(), Player::GetSession(), Object::GetTypeId(), MotionMaster::MoveJumpTo(), WorldSession::SendPacket(), SMSG_MOVE_KNOCK_BACK, Object::ToPlayer(), and TYPEID_UNIT.

Referenced by Spell::EffectLeapBack().

◆ JumpTo() [2/2]

void Unit::JumpTo ( WorldObject obj,
float  speedZ 
)
19454{
19455 float x, y, z;
19456 obj->GetContactPoint(this, x, y, z);
19457 float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ;
19458 GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
19459}
void GetContactPoint(WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
Definition: Object.cpp:2739
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=0)
Definition: MotionMaster.h:227

References WorldObject::GetContactPoint(), Position::GetExactDist2d(), GetMotionMaster(), and MotionMaster::MoveJump().

◆ Kill()

void Unit::Kill ( Unit killer,
Unit victim,
bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
static
Todo:
: do instance binding anyway if the charmer/owner is offline
17620{
17621 // Prevent killing unit twice (and giving reward from kill twice)
17622 if (!victim->GetHealth())
17623 return;
17624
17625 if (killer && !killer->IsInMap(victim))
17626 killer = nullptr;
17627
17628 // find player: owner of controlled `this` or `this` itself maybe
17629 Player* player = killer ? killer->GetCharmerOrOwnerPlayerOrPlayerItself() : nullptr;
17630 Creature* creature = victim->ToCreature();
17631
17632 bool isRewardAllowed = true;
17633 if (creature)
17634 {
17635 isRewardAllowed = creature->IsDamageEnoughForLootingAndReward();
17636 if (!isRewardAllowed)
17637 creature->SetLootRecipient(nullptr);
17638 }
17639
17640 // pussywizard: remade this if section (player is on the same map
17641 if (isRewardAllowed && creature)
17642 {
17643 Player* lr = creature->GetLootRecipient();
17644 if (lr && lr->IsInMap(creature))
17645 player = creature->GetLootRecipient();
17646 else if (Group* lrg = creature->GetLootRecipientGroup())
17647 for (GroupReference* itr = lrg->GetFirstMember(); itr != nullptr; itr = itr->next())
17648 if (Player* member = itr->GetSource())
17649 if (member->IsAtLootRewardDistance(creature))
17650 {
17651 player = member;
17652 break;
17653 }
17654 }
17655
17656 // Exploit fix
17657 if (creature && creature->IsPet() && creature->GetOwnerGUID().IsPlayer())
17658 isRewardAllowed = false;
17659
17660 // Reward player, his pets, and group/raid members
17661 // call kill spell proc event (before real die and combat stop to triggering auras removed at death/combat stop)
17662 if (isRewardAllowed && player && player != victim)
17663 {
17664 WorldPacket data(SMSG_PARTYKILLLOG, (8 + 8)); // send event PARTY_KILL
17665 data << player->GetGUID(); // player with killing blow
17666 data << victim->GetGUID(); // victim
17667
17668 Player* looter = player;
17669 Group* group = player->GetGroup();
17670 bool hasLooterGuid = false;
17671
17672 if (group)
17673 {
17674 group->BroadcastPacket(&data, group->GetMemberGroup(player->GetGUID()));
17675
17676 if (creature)
17677 {
17678 group->UpdateLooterGuid(creature, true);
17679 if (group->GetLooterGuid() && group->GetLootMethod() != FREE_FOR_ALL)
17680 {
17681 looter = ObjectAccessor::FindPlayer(group->GetLooterGuid());
17682 if (looter)
17683 {
17684 hasLooterGuid = true;
17685 creature->SetLootRecipient(looter); // update creature loot recipient to the allowed looter.
17686 }
17687 }
17688 }
17689 }
17690 else
17691 {
17692 player->SendDirectMessage(&data);
17693
17694 if (creature)
17695 {
17696 WorldPacket data2(SMSG_LOOT_LIST, 8 + 1 + 1);
17697 data2 << creature->GetGUID();
17698 data2 << uint8(0); // unk1
17699 data2 << uint8(0); // no group looter
17700 player->SendMessageToSet(&data2, true);
17701 }
17702 }
17703
17704 // Generate loot before updating looter
17705 if (creature)
17706 {
17707 Loot* loot = &creature->loot;
17708 loot->clear();
17709
17710 if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
17711 loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode(), creature);
17712
17713 if (creature->GetLootMode())
17715
17716 if (group)
17717 {
17718 if (hasLooterGuid)
17719 group->SendLooter(creature, looter);
17720 else
17721 group->SendLooter(creature, nullptr);
17722
17723 // Update round robin looter only if the creature had loot
17724 if (!creature->loot.empty())
17725 group->UpdateLooterGuid(creature);
17726 }
17727 }
17728
17729 player->RewardPlayerAndGroupAtKill(victim, false);
17730 }
17731
17732 // Do KILL and KILLED procs. KILL proc is called only for the unit who landed the killing blow (and its owner - for pets and totems) regardless of who tapped the victim
17733 if (killer && (killer->IsPet() || killer->IsTotem()))
17734 if (Unit* owner = killer->GetOwner())
17735 {
17736 Unit::ProcDamageAndSpell(owner, victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17737 sScriptMgr->OnCreatureKilledByPet( killer->GetCharmerOrOwnerPlayerOrPlayerItself(), victim->ToCreature());
17738 }
17739
17740 if (killer != victim)
17741 {
17742 Unit::ProcDamageAndSpell(killer, victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17743 }
17744
17745 // Proc auras on death - must be before aura/combat remove
17746 Unit::ProcDamageAndSpell(victim, nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
17747
17748 // update get killing blow achievements, must be done before setDeathState to be able to require auras on target
17749 // and before Spirit of Redemption as it also removes auras
17750 if (killer)
17751 if (Player* killerPlayer = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
17752 killerPlayer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, 1, 0, victim);
17753
17754 // Spirit of Redemption
17755 // if talent known but not triggered (check priest class for speedup check)
17756 bool spiritOfRedemption = false;
17758 {
17759 if (AuraEffect* aurEff = victim->GetAuraEffectDummy(20711))
17760 {
17761 // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift
17762 if (victim->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) || victim->HasAura(27827))
17763 {
17764 /*LOG_INFO("misc", "Player ({}) died with spirit of redemption. Killer (Entry: {}, Name: {}), Map: {}, x: {}, y: {}, z: {}",
17765 victim->GetGUID().ToString(), killer ? killer->GetEntry() : 1, killer ? killer->GetName() : "", victim->GetMapId(), victim->GetPositionX(),
17766 victim->GetPositionY(), victim->GetPositionZ());
17767
17768 ACE_Stack_Trace trace(0, 50);
17769 LOG_INFO("misc", "TRACE: {}\n\n", trace);*/
17770 }
17771 else
17772 {
17773 // save value before aura remove
17774 uint32 ressSpellId = victim->GetUInt32Value(PLAYER_SELF_RES_SPELL);
17775 if (!ressSpellId)
17776 ressSpellId = victim->ToPlayer()->GetResurrectionSpellId();
17777
17778 //Remove all expected to remove at death auras (most important negative case like DoT or periodic triggers)
17779 victim->RemoveAllAurasOnDeath();
17780
17781 // Stop attacks
17782 victim->CombatStop();
17784
17785 // restore for use at real death
17786 victim->SetUInt32Value(PLAYER_SELF_RES_SPELL, ressSpellId);
17787
17788 // FORM_SPIRITOFREDEMPTION and related auras
17789 victim->CastSpell(victim, 27827, true, nullptr, aurEff);
17790 spiritOfRedemption = true;
17791 }
17792 }
17793 }
17794
17795 if (!spiritOfRedemption)
17796 {
17797 LOG_DEBUG("entities.unit", "SET DeathState::JustDied");
17798 victim->setDeathState(DeathState::JustDied);
17799 }
17800
17801 // Inform pets (if any) when player kills target)
17802 // MUST come after victim->setDeathState(DeathState::JustDied); or pet next target
17803 // selection will get stuck on same target and break pet react state
17804 if (player)
17805 {
17806 Pet* pet = player->GetPet();
17807 if (pet && pet->IsAlive() && pet->isControlled())
17808 pet->AI()->KilledUnit(victim);
17809 }
17810
17811 // 10% durability loss on death
17812 // clean InHateListOf
17813 if (Player* plrVictim = victim->ToPlayer())
17814 {
17815 // remember victim PvP death for corpse type and corpse reclaim delay
17816 // at original death (not at SpiritOfRedemtionTalent timeout)
17817 plrVictim->SetPvPDeath(player != nullptr);
17818
17819 // only if not player and not controlled by player pet. And not at BG
17820 if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP)))
17821 {
17822 LOG_DEBUG("entities.unit", "We are dead, losing {} percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH));
17823 plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false);
17824 // durability lost message
17825 plrVictim->SendDurabilityLoss();
17826 }
17827 // Call KilledUnit for creatures
17828 if (killer && killer->GetTypeId() == TYPEID_UNIT && killer->IsAIEnabled)
17829 killer->ToCreature()->AI()->KilledUnit(victim);
17830
17831 // last damage from non duel opponent or opponent controlled creature
17832 if (plrVictim->duel)
17833 {
17834 plrVictim->duel->Opponent->CombatStopWithPets(true);
17835 plrVictim->CombatStopWithPets(true);
17836 plrVictim->DuelComplete(DUEL_INTERRUPTED);
17837 }
17838 }
17839 else // creature died
17840 {
17841 LOG_DEBUG("entities.unit", "DealDamageNotPlayer");
17842
17843 if (!creature->IsPet() && creature->GetLootMode() > 0)
17844 {
17845 creature->GetThreatMgr().ClearAllThreat();
17846
17847 // must be after setDeathState which resets dynamic flags
17848 if (!creature->loot.isLooted())
17849 {
17851 }
17852 else
17853 {
17854 creature->AllLootRemovedFromCorpse();
17855 }
17856 }
17857
17858 // Call KilledUnit for creatures, this needs to be called after the lootable flag is set
17859 if (killer && killer->GetTypeId() == TYPEID_UNIT && killer->IsAIEnabled)
17860 killer->ToCreature()->AI()->KilledUnit(victim);
17861
17862 // Call creature just died function
17863 if (CreatureAI* ai = creature->AI())
17864 {
17865 ai->JustDied(killer);
17866 }
17867
17868 if (TempSummon* summon = creature->ToTempSummon())
17869 {
17870 if (WorldObject* summoner = summon->GetSummoner())
17871 {
17872 if (summoner->ToCreature() && summoner->ToCreature()->IsAIEnabled)
17873 {
17874 summoner->ToCreature()->AI()->SummonedCreatureDies(creature, killer);
17875 }
17876 else if (summoner->ToGameObject() && summoner->ToGameObject()->AI())
17877 {
17878 summoner->ToGameObject()->AI()->SummonedCreatureDies(creature, killer);
17879 }
17880 }
17881 }
17882
17883 // Dungeon specific stuff, only applies to players killing creatures
17884 if (creature->GetInstanceId())
17885 {
17886 Map* instanceMap = creature->GetMap();
17887 //Player* creditedPlayer = GetCharmerOrOwnerPlayerOrPlayerItself();
17889
17890 if (instanceMap->IsDungeon() && player)
17891 if (instanceMap->IsRaidOrHeroicDungeon())
17893 instanceMap->ToInstanceMap()->PermBindAllPlayers();
17894 }
17895 }
17896
17897 // outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
17898 // handle player kill only if not suicide (spirit of redemption for example)
17899 if (player && killer != victim)
17900 {
17901 if (OutdoorPvP* pvp = player->GetOutdoorPvP())
17902 pvp->HandleKill(player, victim);
17903
17904 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
17905 bf->HandleKill(player, victim);
17906 }
17907
17908 //if (victim->IsPlayer())
17909 // if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
17910 // pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
17911
17912 // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
17913 if (player)
17914 if (Battleground* bg = player->GetBattleground())
17915 {
17916 if (victim->IsPlayer())
17917 bg->HandleKillPlayer(victim->ToPlayer(), player);
17918 else
17919 bg->HandleKillUnit(victim->ToCreature(), player);
17920 }
17921
17922 // achievement stuff
17923 if (killer && victim->IsPlayer())
17924 {
17925 if (killer->GetTypeId() == TYPEID_UNIT)
17927 else if (victim != killer && killer->IsPlayer())
17929 }
17930
17931 // Hook for OnPVPKill Event
17932 if (killer)
17933 {
17934 if (Player* killerPlr = killer->ToPlayer())
17935 {
17936 if (Player* killedPlr = victim->ToPlayer())
17937 sScriptMgr->OnPVPKill(killerPlr, killedPlr);
17938 else if (Creature* killedCre = victim->ToCreature())
17939 sScriptMgr->OnCreatureKill(killerPlr, killedCre);
17940 }
17941 else if (Creature* killerCre = killer->ToCreature())
17942 {
17943 if (Player* killed = victim->ToPlayer())
17944 sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
17945 }
17946 }
17947
17948 sScriptMgr->OnUnitDeath(victim, killer);
17949}
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ PROC_FLAG_KILLED
Definition: SpellMgr.h:107
@ PLAYER_SELF_RES_SPELL
Definition: UpdateFields.h:370
@ CREATURE_FLAG_EXTRA_INSTANCE_BIND
Definition: CreatureData.h:46
@ PLAYER_FLAGS_IS_OUT_OF_BOUNDS
Definition: Player.h:488
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
@ FREE_FOR_ALL
Definition: LootMgr.h:59
@ CONFIG_DURABILITY_LOSS_IN_PVP
Definition: IWorld.h:71
@ RATE_DURABILITY_LOSS_ON_DEATH
Definition: IWorld.h:515
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER
Definition: DBCEnums.h:138
@ ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE
Definition: DBCEnums.h:137
@ ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS
Definition: DBCEnums.h:170
@ UNIT_DYNFLAG_LOOTABLE
Definition: SharedDefines.h:3121
@ DUEL_INTERRUPTED
Definition: SharedDefines.h:3612
@ SMSG_PARTYKILLLOG
Definition: Opcodes.h:531
@ SMSG_LOOT_LIST
Definition: Opcodes.h:1047
Player * FindPlayer(ObjectGuid const guid)
Definition: ObjectAccessor.cpp:248
Definition: CreatureAI.h:71
virtual void KilledUnit(Unit *)
Definition: CreatureAI.h:130
Definition: Battlefield.h:206
Loot loot
Definition: Creature.h:227
uint16 GetLootMode() const
Definition: Creature.h:241
void AllLootRemovedFromCorpse()
Definition: Creature.cpp:2974
Player * GetLootRecipient() const
Definition: Creature.cpp:1299
bool IsDamageEnoughForLootingAndReward() const
Definition: Creature.cpp:3783
Group * GetLootRecipientGroup() const
Definition: Creature.cpp:1306
uint32 mingold
Definition: CreatureData.h:234
uint32 maxgold
Definition: CreatureData.h:235
uint32 lootid
Definition: CreatureData.h:227
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:120
uint32 GetInstanceId() const
Definition: Object.h:441
uint32 GetZoneId() const
Definition: Object.cpp:3141
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:5648
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2084
Battleground * GetBattleground(bool create=false) const
Definition: Player.cpp:12148
uint32 GetResurrectionSpellId()
Definition: Player.cpp:12556
OutdoorPvP * GetOutdoorPvP() const
Definition: Player.cpp:12457
void RewardPlayerAndGroupAtKill(Unit *victim, bool isBattleGround)
Definition: Player.cpp:12676
void RemoveAllAurasOnDeath()
Definition: Unit.cpp:5300
AuraEffect * GetAuraEffectDummy(uint32 spellid) const
Definition: Unit.cpp:5501
void BroadcastPacket(WorldPacket const *packet, bool ignorePlayersInBGRaid, int group=-1, ObjectGuid ignore=ObjectGuid::Empty)
Definition: Group.cpp:1757
uint8 GetMemberGroup(ObjectGuid guid) const
Definition: Group.cpp:2384
ObjectGuid GetLooterGuid() const
Definition: Group.cpp:2321
LootMethod GetLootMethod() const
Definition: Group.cpp:2316
void UpdateLooterGuid(WorldObject *pLootedObject, bool ifneed=false)
Definition: Group.cpp:1868
void SendLooter(Creature *creature, Player *pLooter)
Definition: Group.cpp:969
Definition: LootMgr.h:313
bool empty() const
Definition: LootMgr.h:367
bool isLooted() const
Definition: LootMgr.h:368
void clear()
Definition: LootMgr.h:343
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition: LootMgr.cpp:829
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, WorldObject *lootSource=nullptr)
Definition: LootMgr.cpp:564
Definition: Map.h:313
bool IsRaidOrHeroicDungeon() const
Definition: Map.h:451
InstanceMap * ToInstanceMap()
Definition: Map.h:546
void PermBindAllPlayers()
Definition: Map.cpp:3152
Definition: OutdoorPvP.h:186

References ACHIEVEMENT_CRITERIA_TYPE_GET_KILLING_BLOWS, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_PLAYER, Creature::AI(), Creature::AllLootRemovedFromCorpse(), Group::BroadcastPacket(), CastSpell(), CLASS_CONTEXT_ABILITY, CLASS_PRIEST, Loot::clear(), ThreatMgr::ClearAllThreat(), CombatStop(), CONFIG_DURABILITY_LOSS_IN_PVP, CREATURE_FLAG_EXTRA_INSTANCE_BIND, HostileRefMgr::deleteReferences(), DUEL_INTERRUPTED, Loot::empty(), Loot::FillLoot(), ObjectAccessor::FindPlayer(), CreatureTemplate::flags_extra, FREE_FOR_ALL, Loot::generateMoneyLoot(), GetAuraEffectDummy(), Player::GetBattleground(), GetCharmerOrOwnerPlayerOrPlayerItself(), Creature::GetCreatureTemplate(), Object::GetEntry(), Player::GetGroup(), Object::GetGUID(), GetHealth(), getHostileRefMgr(), WorldObject::GetInstanceId(), Group::GetLooterGuid(), Group::GetLootMethod(), Creature::GetLootMode(), Creature::GetLootRecipient(), Creature::GetLootRecipientGroup(), WorldObject::GetMap(), Group::GetMemberGroup(), Player::GetOutdoorPvP(), GetOwner(), GetOwnerGUID(), Player::GetPet(), Player::GetResurrectionSpellId(), Player::GetTeamId(), GetThreatMgr(), Object::GetTypeId(), Object::GetUInt32Value(), WorldObject::GetZoneId(), HasAura(), HasAuraType(), Player::HasPlayerFlag(), Player::InBattleground(), IsAIEnabled, IsAlive(), IsClass(), Pet::isControlled(), Creature::IsDamageEnoughForLootingAndReward(), Map::IsDungeon(), WorldObject::IsInMap(), Loot::isLooted(), IsPet(), Object::IsPlayer(), ObjectGuid::IsPlayer(), Map::IsRaidOrHeroicDungeon(), IsTotem(), CreatureAI::KilledUnit(), LOG_DEBUG, Creature::loot, CreatureTemplate::lootid, LootTemplates_Creature, CreatureTemplate::maxgold, CreatureTemplate::mingold, GroupReference::next(), InstanceMap::PermBindAllPlayers(), PLAYER_FLAGS_IS_OUT_OF_BOUNDS, PLAYER_SELF_RES_SPELL, PROC_EX_NONE, PROC_FLAG_DEATH, PROC_FLAG_KILL, PROC_FLAG_KILLED, PROC_FLAG_NONE, ProcDamageAndSpell(), RATE_DURABILITY_LOSS_ON_DEATH, RemoveAllAurasOnDeath(), Player::RewardPlayerAndGroupAtKill(), sBattlefieldMgr, Player::SendDirectMessage(), Group::SendLooter(), Player::SendMessageToSet(), setDeathState(), Object::SetDynamicFlag(), Creature::SetLootRecipient(), SetUInt32Value(), SMSG_LOOT_LIST, SMSG_PARTYKILLLOG, SPELL_AURA_SPIRIT_OF_REDEMPTION, sScriptMgr, sWorld, Object::ToCreature(), Map::ToInstanceMap(), Object::ToPlayer(), ToTempSummon(), TYPEID_UNIT, UNIT_DYNFLAG_LOOTABLE, Player::UpdateAchievementCriteria(), and Group::UpdateLooterGuid().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), boss_headless_horseman_head::DamageTaken(), boss_viscidus::DamageTaken(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::DamageTaken(), boss_brutallus::boss_brutallusAI::DamageTaken(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::DamageTaken(), DealDamage(), boss_jedoga_shadowseeker::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), boss_illidari_council::DoAction(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), DeathEvent::Execute(), AuraEffect::HandleAuraControlVehicle(), BattlegroundIC::HandleCapturedNodes(), misc_commandscript::HandleDieCommand(), spell_ooze_zap_channel_end::HandleDummy(), spell_pos_rimefang_frost_nova::HandleDummy(), spell_q12589_shoot_rjr::HandleDummy(), spell_item_chicken_cover::HandleDummy(), spell_yogg_saron_titanic_storm::HandleDummyEffect(), spell_item_rocket_chicken::HandleDummyTick(), spell_ulduar_arachnopod_damaged_aura::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_teron_gorefiend_spiritual_vengeance::HandleEffectRemove(), spell_voa_overcharge::spell_voa_overcharge_AuraScript::HandlePeriodicDummy(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_leotheras_clear_consuming_madness::HandleScriptEffect(), boss_kiljaeden::boss_kiljaedenAI::JustDied(), boss_entropius::boss_entropiusAI::JustDied(), boss_twin_valkyrAI::JustDied(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_sister_svalna::boss_sister_svalnaAI::JustDied(), boss_ignis::boss_ignisAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), boss_ahune::JustDied(), npc_frozen_core::JustDied(), boss_twinemperorsAI::JustDied(), boss_halion::boss_halionAI::JustDied(), boss_twilight_halion::boss_twilight_halionAI::JustDied(), KillSelf(), boss_buru::ManipulateEggs(), npc_burning_spirit::npc_burning_spiritAI::MovementInform(), spell_yogg_saron_insane_aura::OnRemove(), WretchedGhoulCleaner::operator()(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::PassengerBoarded(), SmartScript::ProcessAction(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::RandomizeCompositionsAndShow(), boss_faerlina::boss_faerlinaAI::SpellHit(), npc_cos_stratholme_citizien::npc_cos_stratholme_citizienAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHitTarget(), npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget(), instance_stratholme::instance_stratholme_InstanceMapScript::Update(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::Update(), instance_trial_of_the_crusader::instance_trial_of_the_crusader_InstanceMapScript::Update(), instance_shattered_halls::instance_shattered_halls_InstanceMapScript::Update(), SimpleCharmedAI::UpdateAI(), boss_selin_fireheart::UpdateAI(), npc_crusade_persuaded::npc_crusade_persuadedAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_sinkhole_kill_credit::npc_sinkhole_kill_creditAI::UpdateAI(), npc_boneguard_footman::npc_boneguard_footmanAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), npc_gunship::npc_gunshipAI::UpdateAI(), and npc_emily::npc_emilyAI::WaypointReached().

◆ KillSelf()

void Unit::KillSelf ( bool  durabilityLoss = true,
WeaponAttackType  attackType = BASE_ATTACK,
SpellInfo const *  spellProto = nullptr,
Spell const *  spell = nullptr 
)
inline
896{ Kill(this, this, durabilityLoss, attackType, spellProto, spell); };

References Kill().

Referenced by npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_illidari_council::DoAction(), npc_xt002_boombot::npc_xt002_boombotAI::Explode(), npc_raging_flames::FixateRandomTarget(), npc_rancid_mushroom::InitializeAI(), boss_warlord_kalithresh::JustDied(), npc_pet_gen_plump_turkey::MovementInform(), npc_wild_wyrm::npc_wild_wyrmAI::MovementInform(), npc_announcer_toc5::npc_announcer_toc5AI::MovementInform(), boss_glob_of_viscidus::MovementInform(), SmartScript::ProcessAction(), boss_archimonde::Reset(), npc_dark_iron_guzzler::SpellHit(), boss_victor_nefarius::boss_victor_nefariusAI::SummonedCreatureDies(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDies(), npc_icc_gauntlet_controller::npc_icc_gauntlet_controllerAI::SummonedCreatureDies(), boss_vazruden_the_herald::SummonedCreatureDies(), npc_warden_mellichar::npc_warden_mellicharAI::SummonedCreatureDies(), boss_felblood_kaelthas::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), npc_brewfest_super_brew_trigger::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_sjonnir_malformed_ooze::boss_sjonnir_malformed_oozeAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), and npc_frost_tomb::npc_frost_tombAI::UpdateAI().

◆ KnockbackFrom()

void Unit::KnockbackFrom ( float  x,
float  y,
float  speedXY,
float  speedZ 
)
19061{
19062 Player* player = ToPlayer();
19063 if (!player)
19064 {
19065 if (Unit* charmer = GetCharmer())
19066 {
19067 player = charmer->ToPlayer();
19068 if (player && player->m_mover != this)
19069 player = nullptr;
19070 }
19071 }
19072
19073 if (!player)
19074 {
19075 GetMotionMaster()->MoveKnockbackFrom(x, y, speedXY, speedZ);
19076 }
19077 else
19078 {
19079 float vcos, vsin;
19080 GetSinCos(x, y, vsin, vcos);
19081
19082 WorldPacket data(SMSG_MOVE_KNOCK_BACK, (8 + 4 + 4 + 4 + 4 + 4));
19083 data << GetPackGUID();
19084 data << uint32(0); // counter
19085 data << float(vcos); // x direction
19086 data << float(vsin); // y direction
19087 data << float(speedXY); // Horizontal speed
19088 data << float(-speedZ); // Z Movement speed (vertical)
19089
19090 player->GetSession()->SendPacket(&data);
19091
19093 player->SetCanFly(true, true);
19094
19095 player->SetCanKnockback(true);
19096 }
19097}
@ SPELL_AURA_FLY
Definition: SpellAuraDefines.h:264
@ SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED
Definition: SpellAuraDefines.h:270
void GetSinCos(float x, float y, float &vsin, float &vcos) const
Definition: Position.cpp:91
SafeUnitPointer m_mover
Definition: Player.h:2309
void SetCanKnockback(bool value)
Definition: Player.h:2476
bool SetCanFly(bool apply, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition: Player.cpp:15869
void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ)
Definition: MotionMaster.cpp:555

References GetCharmer(), GetMotionMaster(), Object::GetPackGUID(), Player::GetSession(), Position::GetSinCos(), HasAuraType(), Player::m_mover, MotionMaster::MoveKnockbackFrom(), WorldSession::SendPacket(), Player::SetCanFly(), Player::SetCanKnockback(), SMSG_MOVE_KNOCK_BACK, SPELL_AURA_FLY, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, and Object::ToPlayer().

Referenced by _ExitVehicle(), boss_maexxna::boss_maexxnaAI::DoCastWebWrap(), Spell::EffectKnockBack(), spell_warhead_detonate::HandleDummy(), npc_vekjik::OnGossipSelect(), and npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI().

◆ MagicSpellHitResult()

SpellMissInfo Unit::MagicSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3295{
3296 // Can`t miss on dead target (on skinning for example)
3297 if (!victim->IsAlive() && victim->GetTypeId() != TYPEID_PLAYER)
3298 return SPELL_MISS_NONE;
3299
3300 // vehicles cant miss
3301 if (IsVehicle())
3302 return SPELL_MISS_NONE;
3303
3304 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3305 // resist and deflect chances
3306 // xinef: skip all calculations, proof: Toxic Tolerance quest
3307 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3308 return SPELL_MISS_NONE;
3309
3310 if (spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
3311 {
3312 return SPELL_MISS_NONE;
3313 }
3314
3315 SpellSchoolMask schoolMask = spellInfo->GetSchoolMask();
3316 int32 thisLevel = getLevelForTarget(victim);
3317 if (GetTypeId() == TYPEID_UNIT && ToCreature()->IsTrigger())
3318 thisLevel = std::max<int32>(thisLevel, spellInfo->SpellLevel);
3319 int32 levelDiff = int32(victim->getLevelForTarget(this)) - thisLevel;
3320
3321 int32 MISS_CHANCE_MULTIPLIER;
3322 if (sWorld->getBoolConfig(CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS) && GetTypeId() != TYPEID_PLAYER) // keep it as it was originally (7 and 11)
3323 {
3324 MISS_CHANCE_MULTIPLIER = victim->IsPlayer() ? 7 : 11;
3325 }
3326 else
3327 {
3328 MISS_CHANCE_MULTIPLIER = sWorld->getRate(
3329 victim->IsPlayer()
3332 }
3333
3334 // Base hit chance from attacker and victim levels
3335 int32 modHitChance = levelDiff < 3
3336 ? 96 - levelDiff
3337 : 94 - (levelDiff - 2) * MISS_CHANCE_MULTIPLIER;
3338
3339 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
3340 if (Player* modOwner = GetSpellModOwner())
3341 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_MISS_CHANCE, modHitChance);
3342
3343 // Increase from attacker SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT auras
3345
3346 // Spells with SPELL_ATTR3_ALWAYS_HIT will ignore target's avoidance effects
3347 // xinef: imo it should completly ignore all calculations, eg: 14792. Hits 80 level players on blizz without any problems
3348 //if (!spell->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3349 {
3350 // Chance hit from victim SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE auras
3352 // Reduce spell hit chance for Area of effect spells from victim SPELL_AURA_MOD_AOE_AVOIDANCE aura
3353 if (spellInfo->IsAffectingArea())
3354 modHitChance -= victim->GetTotalAuraModifier(SPELL_AURA_MOD_AOE_AVOIDANCE);
3355
3356 // Decrease hit chance from victim rating bonus
3357 if (victim->IsPlayer())
3358 modHitChance -= int32(victim->ToPlayer()->GetRatingBonusValue(CR_HIT_TAKEN_SPELL));
3359 }
3360
3361 int32 HitChance = modHitChance * 100;
3362 // Increase hit chance from attacker SPELL_AURA_MOD_SPELL_HIT_CHANCE and attacker ratings
3363 // Xinef: Totems should inherit casters ratings?
3364 if (IsTotem())
3365 {
3366 if (Unit* owner = GetOwner())
3367 HitChance += int32(owner->m_modSpellHitChance * 100.0f);
3368 }
3369 else
3370 HitChance += int32(m_modSpellHitChance * 100.0f);
3371
3372 if (HitChance < 100)
3373 HitChance = 100;
3374 else if (HitChance > 10000)
3375 HitChance = 10000;
3376
3377 int32 tmp = 10000 - HitChance;
3378
3379 int32 rand = irand(1, 10000); // Needs to be 1 to 10000 to avoid the 1/10000 chance to miss on 100% hit rating
3380
3381 if (rand < tmp)
3382 return SPELL_MISS_MISS;
3383
3384 // Chance resist mechanic (select max value from every mechanic spell effect)
3385 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3386 tmp += resist_chance;
3387
3388 // Chance resist debuff
3389 if (!spellInfo->IsPositive() && !spellInfo->HasAttribute(SPELL_ATTR4_NO_CAST_LOG))
3390 {
3391 bool bNegativeAura = true;
3392 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3393 {
3394 // Xinef: Check if effect exists!
3395 if (spellInfo->Effects[i].IsEffect() && spellInfo->Effects[i].ApplyAuraName == 0)
3396 {
3397 bNegativeAura = false;
3398 break;
3399 }
3400 }
3401
3402 if (bNegativeAura)
3403 {
3404 tmp += victim->GetMaxPositiveAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3405 tmp += victim->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_DEBUFF_RESISTANCE, int32(spellInfo->Dispel)) * 100;
3406 }
3407
3408 // Players resistance for binary spells
3409 if (spellInfo->HasAttribute(SPELL_ATTR0_CU_BINARY_SPELL) && (spellInfo->GetSchoolMask() & (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_HOLY)) == 0)
3410 tmp += int32(Unit::GetEffectiveResistChance(this, spellInfo->GetSchoolMask(), victim) * 10000.0f); // 100 for spell calculations, and 100 for return value percentage
3411 }
3412
3413 // Roll chance
3414 if (rand < tmp)
3415 return SPELL_MISS_RESIST;
3416
3417 // cast by caster in front of victim
3418 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
3419 {
3420 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3421 tmp += deflect_chance;
3422 if (rand < tmp)
3423 return SPELL_MISS_DEFLECT;
3424 }
3425
3426 return SPELL_MISS_NONE;
3427}
@ SPELLMOD_RESIST_MISS_CHANCE
Definition: SpellDefines.h:93
@ SPELL_AURA_MOD_DEBUFF_RESISTANCE
Definition: SpellAuraDefines.h:241
@ SPELL_AURA_DEFLECT_SPELLS
Definition: SpellAuraDefines.h:350
@ SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
Definition: SpellAuraDefines.h:262
@ SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE
Definition: SpellAuraDefines.h:249
@ SPELL_AURA_MOD_AOE_AVOIDANCE
Definition: SpellAuraDefines.h:223
@ CR_HIT_TAKEN_SPELL
Definition: Unit.h:230
@ CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS
Definition: IWorld.h:178
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER
Definition: IWorld.h:522
@ RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE
Definition: IWorld.h:521
@ SPELL_ATTR7_NO_ATTACK_MISS
Definition: SharedDefines.h:666
@ SPELL_MISS_NONE
Definition: SharedDefines.h:1519
@ SPELL_MISS_RESIST
Definition: SharedDefines.h:1521
@ SPELL_MISS_MISS
Definition: SharedDefines.h:1520
@ SPELL_MISS_DEFLECT
Definition: SharedDefines.h:1528
float GetRatingBonusValue(CombatRating cr) const
Definition: Player.cpp:5141
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:6003
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const
Definition: Unit.cpp:5989
int32 GetMechanicResistChance(SpellInfo const *spell)
Definition: Unit.cpp:3100

References CONFIG_MISS_CHANCE_MULTIPLIER_ONLY_FOR_PLAYERS, CR_HIT_TAKEN_SPELL, SpellInfo::Dispel, SpellInfo::Effects, GetEffectiveResistChance(), getLevelForTarget(), GetMaxNegativeAuraModifierByMiscValue(), GetMaxPositiveAuraModifierByMiscValue(), GetMechanicResistChance(), GetOwner(), Player::GetRatingBonusValue(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAuraType(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, irand(), SpellInfo::IsAffectingArea(), IsAlive(), Object::IsPlayer(), SpellInfo::IsPositive(), IsTotem(), IsVehicle(), m_modSpellHitChance, MAX_SPELL_EFFECTS, RATE_MISS_CHANCE_MULTIPLIER_TARGET_CREATURE, RATE_MISS_CHANCE_MULTIPLIER_TARGET_PLAYER, SPELL_ATTR0_CU_BINARY_SPELL, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR4_NO_CAST_LOG, SPELL_ATTR7_NO_ATTACK_MISS, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_HIT_DIRECTION, SPELL_AURA_MOD_AOE_AVOIDANCE, SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE, SPELL_AURA_MOD_DEBUFF_RESISTANCE, SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT, SPELL_MISS_DEFLECT, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_RESIST, SPELL_SCHOOL_MASK_HOLY, SPELL_SCHOOL_MASK_NORMAL, SpellInfo::SpellLevel, SPELLMOD_RESIST_MISS_CHANCE, sWorld, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and UNIT_STATE_STUNNED.

Referenced by SpellHitResult().

◆ MeleeDamageBonusDone()

uint32 Unit::MeleeDamageBonusDone ( Unit pVictim,
uint32  damage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
13010{
13011 if (!victim || pdamage == 0)
13012 return 0;
13013
13014 if (GetTypeId() == TYPEID_UNIT)
13015 {
13016 // Dancing Rune Weapon...
13017 if (GetEntry() == 27893)
13018 {
13019 if (Unit* owner = GetOwner())
13020 return owner->MeleeDamageBonusDone(victim, pdamage, attType, spellProto, damageSchoolMask) / 2;
13021 }
13022 }
13023
13024 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
13025
13026 // Done fixed damage bonus auras
13027 int32 DoneFlatBenefit = 0;
13028
13029 // ..done
13031 for (AuraEffectList::const_iterator i = mDamageDoneCreature.begin(); i != mDamageDoneCreature.end(); ++i)
13032 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13033 DoneFlatBenefit += (*i)->GetAmount();
13034
13035 // ..done
13036 // SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage
13037
13038 // ..done (base at attack power for marked target and base at attack power for creature type)
13039 int32 APbonus = 0;
13040
13041 if (attType == RANGED_ATTACK)
13042 {
13043 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
13044
13045 // ..done (base at attack power and creature type)
13047 for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
13048 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13049 APbonus += (*i)->GetAmount();
13050 }
13051 else
13052 {
13053 APbonus += victim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
13054
13055 // ..done (base at attack power and creature type)
13057 for (AuraEffectList::const_iterator i = mCreatureAttackPower.begin(); i != mCreatureAttackPower.end(); ++i)
13058 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13059 APbonus += (*i)->GetAmount();
13060 }
13061
13062 if (APbonus != 0) // Can be negative
13063 {
13064 bool normalized = false;
13065 if (spellProto)
13066 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
13067 if (spellProto->Effects[i].Effect == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
13068 {
13069 normalized = true;
13070 break;
13071 }
13072 DoneFlatBenefit += int32(APbonus / 14.0f * GetAPMultiplier(attType, normalized));
13073 }
13074
13075 // Done total percent damage auras
13076 float DoneTotalMod = 1.0f;
13077
13078 // mods for SPELL_SCHOOL_MASK_NORMAL are already factored in base melee damage calculation
13079 if (!(damageSchoolMask & SPELL_SCHOOL_MASK_NORMAL))
13080 {
13081 // Some spells don't benefit from pct done mods
13083 for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
13084 {
13085 if (!spellProto || (spellProto->ValidateAttribute6SpellDamageMods(this, *i, false) &&
13086 sScriptMgr->IsNeedModMeleeDamagePercent(this, *i, DoneTotalMod, spellProto)))
13087 {
13088 if (((*i)->GetMiscValue() & damageSchoolMask))
13089 {
13090 if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
13091 AddPct(DoneTotalMod, (*i)->GetAmount());
13092 else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
13093 AddPct(DoneTotalMod, (*i)->GetAmount());
13094 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
13095 AddPct(DoneTotalMod, (*i)->GetAmount());
13096 }
13097 }
13098 }
13099 }
13100
13102 for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
13103 if (creatureTypeMask & uint32((*i)->GetMiscValue()))
13104 if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13105 AddPct(DoneTotalMod, (*i)->GetAmount());
13106
13107 // bonus against aurastate
13109 for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
13110 if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())))
13111 if (!spellProto || spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13112 AddPct(DoneTotalMod, (*i)->GetAmount());
13113
13114 // done scripted mod (take it from owner)
13115 Unit* owner = GetOwner() ? GetOwner() : this;
13116 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
13117 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
13118 {
13119 if (spellProto && !spellProto->ValidateAttribute6SpellDamageMods(this, *i, false))
13120 continue;
13121
13122 if (!(*i)->IsAffectedOnSpell(spellProto))
13123 continue;
13124
13125 switch ((*i)->GetMiscValue())
13126 {
13127 // Tundra Stalker
13128 // Merciless Combat
13129 case 7277:
13130 {
13131 // Merciless Combat
13132 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
13133 {
13134 if (!victim->HealthAbovePct(35))
13135 AddPct(DoneTotalMod, (*i)->GetAmount());
13136 }
13137 // Tundra Stalker
13138 else
13139 {
13140 // Frost Fever (target debuff)
13141 if (victim->HasAura(55095))
13142 AddPct(DoneTotalMod, (*i)->GetAmount());
13143 }
13144 break;
13145 }
13146 // Rage of Rivendare
13147 case 7293:
13148 {
13149 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0x02000000, 0))
13150 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
13151 break;
13152 }
13153 // Marked for Death
13154 case 7598:
13155 case 7599:
13156 case 7600:
13157 case 7601:
13158 case 7602:
13159 {
13160 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
13161 AddPct(DoneTotalMod, (*i)->GetAmount());
13162 break;
13163 }
13164 // Dirty Deeds
13165 case 6427:
13166 case 6428:
13167 {
13168 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
13169 {
13170 // effect 0 has expected value but in negative state
13171 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
13172 AddPct(DoneTotalMod, bonus);
13173 }
13174 break;
13175 }
13176 }
13177 }
13178
13179 // Custom scripted damage
13180 if (spellProto)
13181 switch (spellProto->SpellFamilyName)
13182 {
13184 // Glacier Rot
13185 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
13187 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
13188 AddPct(DoneTotalMod, aurEff->GetAmount());
13189 break;
13190 }
13191
13192 // Some spells don't benefit from done mods
13193 if (spellProto)
13194 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
13195 {
13196 DoneFlatBenefit = 0;
13197 DoneTotalMod = 1.0f;
13198 }
13199
13200 float tmpDamage = float(int32(pdamage) + DoneFlatBenefit) * DoneTotalMod;
13201
13202 // apply spellmod to Done damage
13203 if (spellProto)
13204 if (Player* modOwner = GetSpellModOwner())
13205 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_DAMAGE, tmpDamage);
13206
13207 // bonus result can be negative
13208 return uint32(std::max(tmpDamage, 0.0f));
13209}
@ SPELLMOD_DAMAGE
Definition: SpellDefines.h:77
@ SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS
Definition: SpellAuraDefines.h:165
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS
Definition: SpellAuraDefines.h:231
@ SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS
Definition: SpellAuraDefines.h:194
@ SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
Definition: SpellAuraDefines.h:142
@ SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE
Definition: SpellAuraDefines.h:366
@ SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
Definition: SpellAuraDefines.h:122
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
Definition: SharedDefines.h:899
@ SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM
Definition: SharedDefines.h:583
@ SPELL_ATTR3_IGNORE_CASTER_MODIFIERS
Definition: SharedDefines.h:522
float GetAPMultiplier(WeaponAttackType attType, bool normalized)
Definition: Unit.cpp:17146
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.h:1319

References AddPct(), AURA_STATE_HEALTHLESS_35_PERCENT, SpellInfo::Effects, GetAPMultiplier(), GetAuraEffect(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetOwner(), GetSpellModOwner(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HealthAbovePct(), SpellInfo::Id, MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_DAMAGE_DONE_CREATURE, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_DAMAGE, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeDamageBonusTaken()

uint32 Unit::MeleeDamageBonusTaken ( Unit attacker,
uint32  pdamage,
WeaponAttackType  attType,
SpellInfo const *  spellProto = nullptr,
SpellSchoolMask  damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL 
)
13212{
13213 if (pdamage == 0)
13214 return 0;
13215
13216 int32 TakenFlatBenefit = 0;
13217
13218 // ..taken
13220 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
13221 if ((*i)->GetMiscValue() & damageSchoolMask)
13222 TakenFlatBenefit += (*i)->GetAmount();
13223
13224 if (attType != RANGED_ATTACK)
13226 else
13228
13229 // Taken total percent damage auras
13230 float TakenTotalMod = 1.0f;
13231
13233
13234 // .. taken pct (special attacks)
13235 if (spellProto)
13236 {
13237 // From caster spells
13239 for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
13240 if ((*i)->GetCasterGUID() == attacker->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
13241 AddPct(TakenTotalMod, (*i)->GetAmount());
13242
13243 // Mod damage from spell mechanic
13244 uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask();
13245
13246 // Shred, Maul - "Effects which increase Bleed damage also increase Shred damage"
13247 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[0] & 0x00008800)
13248 mechanicMask |= (1 << MECHANIC_BLEED);
13249
13250 if (mechanicMask)
13251 {
13253 for (AuraEffectList::const_iterator i = mDamageDoneMechanic.begin(); i != mDamageDoneMechanic.end(); ++i)
13254 if (mechanicMask & uint32(1 << ((*i)->GetMiscValue())))
13255 AddPct(TakenTotalMod, (*i)->GetAmount());
13256 }
13257 }
13258
13259 TakenTotalMod = processDummyAuras(TakenTotalMod);
13260
13261 // .. taken pct: class scripts
13262 /*AuraEffectList const& mclassScritAuras = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
13263 for (AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
13264 {
13265 switch ((*i)->GetMiscValue())
13266 {
13267 }
13268 }*/
13269
13270 if (attType != RANGED_ATTACK)
13271 {
13273 for (AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
13274 AddPct(TakenTotalMod, (*i)->GetAmount());
13275 }
13276 else
13277 {
13278 AuraEffectList const& mModRangedDamageTakenPercent = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
13279 for (AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
13280 AddPct(TakenTotalMod, (*i)->GetAmount());
13281 }
13282
13283 // No positive taken bonus, custom attr
13284 if (spellProto)
13285 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
13286 {
13287 TakenFlatBenefit = 0;
13288 TakenTotalMod = 1.0f;
13289 }
13290
13291 // xinef: sanctified wrath talent
13292 if (TakenTotalMod < 1.0f && attacker->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
13293 {
13294 float ignoreModifier = 1.0f - TakenTotalMod;
13295 bool addModifier = false;
13297 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
13298 if ((*j)->GetMiscValue() & damageSchoolMask)
13299 {
13300 ApplyPct(ignoreModifier, (*j)->GetAmount());
13301 addModifier = true;
13302 }
13303
13304 if (addModifier)
13305 TakenTotalMod += ignoreModifier;
13306 }
13307
13308 float tmpDamage = (float(pdamage) + TakenFlatBenefit) * TakenTotalMod;
13309
13310 // bonus result can be negative
13311 return uint32(std::max(tmpDamage, 0.0f));
13312}
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:176
@ SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
Definition: SpellAuraDefines.h:150
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:188
@ SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT
Definition: SpellAuraDefines.h:189
@ SPELL_AURA_MOD_DAMAGE_TAKEN
Definition: SpellAuraDefines.h:77
@ SPELL_AURA_MOD_DAMAGE_FROM_CASTER
Definition: SpellAuraDefines.h:334
@ SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
Definition: SpellAuraDefines.h:318
@ SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT
Definition: SpellAuraDefines.h:177
@ SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS
Definition: SpellInfo.h:197
float processDummyAuras(float TakenTotalMod) const
Definition: Unit.cpp:11837

References AddPct(), ApplyPct(), SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), Object::GetGUID(), GetTotalAuraModifier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::HasAttribute(), HasAuraType(), MECHANIC_BLEED, processDummyAuras(), RANGED_ATTACK, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN, SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN, SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by CalculateMeleeDamage(), and Spell::EffectWeaponDmg().

◆ MeleeSpellHitResult()

SpellMissInfo Unit::MeleeSpellHitResult ( Unit victim,
SpellInfo const *  spell 
)
3122{
3123 // Spells with SPELL_ATTR3_ALWAYS_HIT will additionally fully ignore
3124 // resist and deflect chances
3125 if (spellInfo->HasAttribute(SPELL_ATTR3_ALWAYS_HIT))
3126 return SPELL_MISS_NONE;
3127
3128 WeaponAttackType attType = BASE_ATTACK;
3129
3130 // Check damage class instead of attack type to correctly handle judgements
3131 // - they are meele, but can't be dodged/parried/deflected because of ranged dmg class
3132 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
3133 attType = RANGED_ATTACK;
3134
3135 int32 attackerWeaponSkill;
3136 // skill value for these spells (for example judgements) is 5* level
3137 if (spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spellInfo->IsRangedWeaponSpell())
3138 attackerWeaponSkill = GetLevel() * 5;
3139 // bonus from skills is 0.04% per skill Diff
3140 else
3141 attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
3142
3143 int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this));
3144
3145 uint32 roll = urand (0, 10000);
3146
3147 uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spellInfo->Id) * 100.0f);
3148 // Roll miss
3149 uint32 tmp = missChance;
3150 if (roll < tmp)
3151 return SPELL_MISS_MISS;
3152
3153 bool canDodge = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_DODGE);
3154 bool canParry = !spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_PARRY);
3155 bool canBlock = spellInfo->HasAttribute(SPELL_ATTR3_COMPLETELY_BLOCKED) && !spellInfo->HasAttribute(SPELL_ATTR0_CU_DIRECT_DAMAGE);
3156
3157 // Same spells cannot be parry/dodge
3158 if (spellInfo->HasAttribute(SPELL_ATTR0_NO_ACTIVE_DEFENSE))
3159 return SPELL_MISS_NONE;
3160
3161 // Chance resist mechanic
3162 int32 resist_chance = victim->GetMechanicResistChance(spellInfo) * 100;
3163 tmp += resist_chance;
3164 if (roll < tmp)
3165 return SPELL_MISS_RESIST;
3166
3167 // Ranged attacks can only miss, resist and deflect
3168 if (attType == RANGED_ATTACK)
3169 {
3170 // only if in front
3171 if (!victim->HasUnitState(UNIT_STATE_STUNNED) && (victim->HasInArc(M_PI, this) || victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)))
3172 {
3173 int32 deflect_chance = victim->GetTotalAuraModifier(SPELL_AURA_DEFLECT_SPELLS) * 100;
3174 tmp += deflect_chance;
3175 if (roll < tmp)
3176 return SPELL_MISS_DEFLECT;
3177 }
3178
3179 canDodge = false;
3180 canParry = false;
3181 }
3182
3183 // Check for attack from behind
3184 // xinef: if from behind or spell requires cast from behind
3185 if (!victim->HasInArc(M_PI, this))
3186 {
3188 {
3189 // Can`t dodge from behind in PvP (but its possible in PvE)
3190 if (victim->IsPlayer())
3191 {
3192 canDodge = false;
3193 }
3194
3195 // Can`t parry or block
3196 canParry = false;
3197 canBlock = false;
3198 }
3199 }
3200
3201 // Check creatures flags_extra for disable parry
3202 if (victim->GetTypeId() == TYPEID_UNIT)
3203 {
3204 uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
3205 // Xinef: no dodge flag
3206 if (flagEx & CREATURE_FLAG_EXTRA_NO_DODGE)
3207 canDodge = false;
3208 if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
3209 canParry = false;
3210 // Check creatures flags_extra for disable block
3211 if (flagEx & CREATURE_FLAG_EXTRA_NO_BLOCK)
3212 canBlock = false;
3213 }
3214 // Ignore combat result aura
3216 for (AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
3217 {
3218 if (!(*i)->IsAffectedOnSpell(spellInfo))
3219 continue;
3220 switch ((*i)->GetMiscValue())
3221 {
3222 case MELEE_HIT_DODGE:
3223 canDodge = false;
3224 break;
3225 case MELEE_HIT_BLOCK:
3226 canBlock = false;
3227 break;
3228 case MELEE_HIT_PARRY:
3229 canParry = false;
3230 break;
3231 default:
3232 LOG_DEBUG("entities.unit", "Spell {} SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state {}", (*i)->GetId(), (*i)->GetMiscValue());
3233 break;
3234 }
3235 }
3236
3237 if (canDodge)
3238 {
3239 // Roll dodge
3240 int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f) - skillDiff * 4;
3241 // Reduce enemy dodge chance by SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
3243 dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
3244 // Reduce dodge chance by attacker expertise rating
3245 if (IsPlayer())
3246 dodgeChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3247 else
3249
3250 // xinef: cant dodge while casting or while stunned
3251 if (dodgeChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3252 dodgeChance = 0;
3253
3254 tmp += dodgeChance;
3255 if (roll < tmp)
3256 return SPELL_MISS_DODGE;
3257 }
3258
3259 if (canParry)
3260 {
3261 // Roll parry
3262 int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4;
3263 // Reduce parry chance by attacker expertise rating
3264 if (IsPlayer())
3265 parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
3266 else
3268
3269 // xinef: cant parry while casting or while stunned
3270 if (parryChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3271 parryChance = 0;
3272
3273 tmp += parryChance;
3274 if (roll < tmp)
3275 return SPELL_MISS_PARRY;
3276 }
3277
3278 if (canBlock)
3279 {
3280 int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4;
3281
3282 // xinef: cant block while casting or while stunned
3283 if (blockChance < 0 || victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
3284 blockChance = 0;
3285
3286 tmp += blockChance;
3287 if (roll < tmp)
3288 return SPELL_MISS_BLOCK;
3289 }
3290
3291 return SPELL_MISS_NONE;
3292}
@ SPELL_AURA_MOD_EXPERTISE
Definition: SpellAuraDefines.h:303
@ SPELL_AURA_IGNORE_COMBAT_RESULT
Definition: SpellAuraDefines.h:265
@ SPELL_AURA_MOD_ENEMY_DODGE
Definition: SpellAuraDefines.h:314
@ SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
Definition: SpellAuraDefines.h:311
@ SPELL_ATTR0_CU_DIRECT_DAMAGE
Definition: SpellInfo.h:184
@ SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET
Definition: SpellInfo.h:193
@ CREATURE_FLAG_EXTRA_NO_PARRY
Definition: CreatureData.h:48
@ CREATURE_FLAG_EXTRA_NO_DODGE
Definition: CreatureData.h:69
@ SPELL_ATTR7_NO_ATTACK_PARRY
Definition: SharedDefines.h:665
@ SPELL_ATTR7_NO_ATTACK_DODGE
Definition: SharedDefines.h:664
@ SPELL_ATTR3_COMPLETELY_BLOCKED
Definition: SharedDefines.h:496
@ SPELL_MISS_PARRY
Definition: SharedDefines.h:1523
@ SPELL_MISS_DODGE
Definition: SharedDefines.h:1522
@ SPELL_MISS_BLOCK
Definition: SharedDefines.h:1524
float GetUnitDodgeChance() const
Definition: Unit.cpp:3607
float GetTotalAuraMultiplier(AuraType auratype) const
Definition: Unit.cpp:5875
float GetUnitParryChance() const
Definition: Unit.cpp:3624
float MeleeSpellMissChance(Unit const *victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
Definition: Unit.cpp:18905

References BASE_ATTACK, CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, SpellInfo::DmgClass, CreatureTemplate::flags_extra, GetAuraEffectsByType(), Creature::GetCreatureTemplate(), GetLevel(), GetMaxSkillValueForLevel(), GetMechanicResistChance(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), Object::GetTypeId(), GetUnitBlockChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), SpellInfo::HasAttribute(), HasAuraType(), Position::HasInArc(), HasUnitState(), SpellInfo::Id, IsNonMeleeSpellCast(), Object::IsPlayer(), SpellInfo::IsRangedWeaponSpell(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_DODGE, MELEE_HIT_PARRY, MeleeSpellMissChance(), RANGED_ATTACK, SPELL_ATTR0_CU_DIRECT_DAMAGE, SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET, SPELL_ATTR0_NO_ACTIVE_DEFENSE, SPELL_ATTR3_ALWAYS_HIT, SPELL_ATTR3_COMPLETELY_BLOCKED, SPELL_ATTR7_NO_ATTACK_DODGE, SPELL_ATTR7_NO_ATTACK_PARRY, SPELL_AURA_DEFLECT_SPELLS, SPELL_AURA_IGNORE_COMBAT_RESULT, SPELL_AURA_IGNORE_HIT_DIRECTION, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, SPELL_DAMAGE_CLASS_RANGED, SPELL_MISS_BLOCK, SPELL_MISS_DEFLECT, SPELL_MISS_DODGE, SPELL_MISS_MISS, SPELL_MISS_NONE, SPELL_MISS_PARRY, SPELL_MISS_RESIST, Object::ToCreature(), Object::ToPlayer(), TYPEID_UNIT, UNIT_STATE_CONTROLLED, UNIT_STATE_STUNNED, urand(), and VICTIMSTATE_DODGE.

Referenced by SpellHitResult().

◆ MeleeSpellMissChance()

float Unit::MeleeSpellMissChance ( Unit const *  victim,
WeaponAttackType  attType,
int32  skillDiff,
uint32  spellId 
) const
18906{
18907 SpellInfo const* spellInfo = spellId ? sSpellMgr->GetSpellInfo(spellId) : nullptr;
18908 if (spellInfo && spellInfo->HasAttribute(SPELL_ATTR7_NO_ATTACK_MISS))
18909 {
18910 return 0.0f;
18911 }
18912
18913 //calculate miss chance
18914 float missChance = victim->GetUnitMissChance(attType);
18915
18916 // Check if dual wielding, add additional miss penalty - when mainhand has on next swing spell, offhand doesnt suffer penalty
18917 if (!spellId && (attType != RANGED_ATTACK) && haveOffhandWeapon() && (!m_currentSpells[CURRENT_MELEE_SPELL] || !m_currentSpells[CURRENT_MELEE_SPELL]->IsNextMeleeSwingSpell()))
18918 {
18919 missChance += 19;
18920 }
18921
18922 // bonus from skills is 0.04%
18923 //miss_chance -= skillDiff * 0.04f;
18924 int32 diff = -skillDiff;
18925 if (victim->IsPlayer())
18926 missChance += diff > 0 ? diff * 0.04f : diff * 0.02f;
18927 else
18928 missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
18929
18930 // Calculate hit chance
18931 float hitChance = 100.0f;
18932
18933 // Spellmod from SPELLMOD_RESIST_MISS_CHANCE
18934 if (spellId)
18935 {
18936 if (Player* modOwner = GetSpellModOwner())
18937 modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance);
18938 }
18939
18940 missChance -= hitChance - 100.0f;
18941
18942 if (attType == RANGED_ATTACK)
18943 missChance -= m_modRangedHitChance;
18944 else
18945 missChance -= m_modMeleeHitChance;
18946
18947 // Limit miss chance from 0 to 60%
18948 if (missChance < 0.0f)
18949 return 0.0f;
18950 if (missChance > 60.0f)
18951 return 60.0f;
18952 return missChance;
18953}

References CURRENT_MELEE_SPELL, GetSpellModOwner(), GetUnitMissChance(), SpellInfo::HasAttribute(), haveOffhandWeapon(), Object::IsPlayer(), m_currentSpells, m_modMeleeHitChance, m_modRangedHitChance, RANGED_ATTACK, SPELL_ATTR7_NO_ATTACK_MISS, SPELLMOD_RESIST_MISS_CHANCE, and sSpellMgr.

Referenced by MeleeSpellHitResult(), and RollMeleeOutcomeAgainst().

◆ ModifyAuraState()

void Unit::ModifyAuraState ( AuraStateType  flag,
bool  apply 
)
10438{
10439 if (apply)
10440 {
10441 if (!HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
10442 {
10443 SetFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10444 Unit::AuraMap& tAuras = GetOwnedAuras();
10445 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
10446 {
10447 if( (*itr).second->IsRemoved() )
10448 continue;
10449
10450 if( (*itr).second->GetSpellInfo()->CasterAuraState == flag )
10451 if( AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) )
10452 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, true);
10453 }
10454 }
10455 }
10456 else
10457 {
10458 if (HasFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1)))
10459 {
10460 RemoveFlag(UNIT_FIELD_AURASTATE, 1 << (flag - 1));
10461
10462 if (flag != AURA_STATE_ENRAGE) // enrage aura state triggering continues auras
10463 {
10464 Unit::AuraMap& tAuras = GetOwnedAuras();
10465 for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end(); ++itr)
10466 {
10467 if( (*itr).second->GetSpellInfo()->CasterAuraState == flag )
10468 if( AuraApplication* aurApp = (*itr).second->GetApplicationOfTarget(GetGUID()) )
10469 (*itr).second->HandleAllEffects(aurApp, AURA_EFFECT_HANDLE_REAL, false);
10470 }
10471 }
10472 }
10473 }
10474}
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
@ AURA_STATE_ENRAGE
Definition: SharedDefines.h:1309
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:845
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:860
std::multimap< uint32, Aura * > AuraMap
Definition: Unit.h:635
AuraMap & GetOwnedAuras()
Definition: Unit.h:1257

References AURA_EFFECT_HANDLE_REAL, AURA_STATE_ENRAGE, Object::GetGUID(), GetOwnedAuras(), Object::HasFlag(), Object::RemoveFlag(), Object::SetFlag(), and UNIT_FIELD_AURASTATE.

Referenced by _ApplyAura(), _UnapplyAura(), ClearAllReactives(), Spell::finish(), debug_commandscript::HandleDebugSetAuraStateCommand(), boss_professor_putricide::boss_professor_putricideAI::JustSummoned(), ProcDamageAndSpellFor(), Update(), and UpdateReactives().

◆ ModifyHealth()

int32 Unit::ModifyHealth ( int32  val)
14021{
14022 int32 gain = 0;
14023
14024 if (dVal == 0)
14025 return 0;
14026
14027 int32 curHealth = (int32)GetHealth();
14028
14029 int32 val = dVal + curHealth;
14030 if (val <= 0)
14031 {
14032 SetHealth(0);
14033 return -curHealth;
14034 }
14035
14036 int32 maxHealth = (int32)GetMaxHealth();
14037
14038 if (val < maxHealth)
14039 {
14040 SetHealth(val);
14041 gain = val - curHealth;
14042 }
14043 else if (curHealth != maxHealth)
14044 {
14045 SetHealth(maxHealth);
14046 gain = maxHealth - curHealth;
14047 }
14048
14049 return gain;
14050}

References GetHealth(), GetMaxHealth(), and SetHealth().

Referenced by DealDamage(), DealHeal(), boss_xt002::boss_xt002AI::DoAction(), boss_ichoron::boss_ichoronAI::DoAction(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandlePeriodicHealthFunnelAuraTick(), boss_hadronox::boss_hadronoxAI::KilledUnit(), boss_gluth::boss_gluthAI::KilledUnit(), Creature::RegenerateHealth(), Player::RegenerateHealth(), npc_injured_patient::npc_injured_patientAI::Reset(), Spell::TakePower(), Aura::Update(), and npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI().

◆ ModifyPower()

int32 Unit::ModifyPower ( Powers  power,
int32  val,
bool  withPowerUpdate = true 
)
14079{
14080 if (dVal == 0)
14081 return 0;
14082
14083 int32 gain = 0;
14084
14085 int32 curPower = (int32)GetPower(power);
14086
14087 int32 val = dVal + curPower;
14088 if (val <= 0)
14089 {
14090 SetPower(power, 0, withPowerUpdate);
14091 return -curPower;
14092 }
14093
14094 int32 maxPower = (int32)GetMaxPower(power);
14095
14096 if (val < maxPower)
14097 {
14098 SetPower(power, val, withPowerUpdate);
14099 gain = val - curPower;
14100 }
14101 else if (curPower != maxPower)
14102 {
14103 SetPower(power, maxPower, withPowerUpdate);
14104 gain = maxPower - curPower;
14105 }
14106
14107 if (GetAI())
14108 {
14109 GetAI()->OnPowerUpdate(power, gain, dVal, curPower);
14110 }
14111
14112 return gain;
14113}
virtual void OnPowerUpdate(Powers, int32, int32, uint32)
Called when the creature power updates.
Definition: UnitAI.h:375
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15493

References GetAI(), GetMaxPower(), GetPower(), UnitAI::OnPowerUpdate(), and SetPower().

Referenced by CalcAbsorbResist(), spell_igb_cannon_blast::CalculatePower(), Spell::EffectPowerBurn(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), EnergizeBySpell(), AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), spell_kelthuzad_detonate_mana_aura::HandleScript(), boss_pathaleon_the_calculator::JustEngagedWith(), boss_curator::JustEngagedWith(), Pet::LoseHappiness(), ModifyPowerPct(), Creature::Regenerate(), RewardRage(), Pet::setDeathState(), Spell::TakePower(), Spell::TakeRunePower(), Aura::Update(), and boss_faction_championsAI::UpdateAI().

◆ ModifyPowerPct()

int32 Unit::ModifyPowerPct ( Powers  power,
float  pct,
bool  apply = true 
)
14117{
14118 float amount = (float)GetMaxPower(power);
14119 ApplyPercentModFloatVar(amount, pct, apply);
14120
14121 return ModifyPower(power, (int32)amount - (int32)GetMaxPower(power));
14122}

References ApplyPercentModFloatVar(), GetMaxPower(), and ModifyPower().

Referenced by AuraEffect::HandleAuraModIncreaseEnergyPercent().

◆ ModifyRedirectThreat()

void Unit::ModifyRedirectThreat ( int32  amount)
inline
void ModifyThreatPct(int32 amount)
Definition: ThreatMgr.h:308

References _redirectThreatInfo, and RedirectThreatInfo::ModifyThreatPct().

Referenced by spell_warr_vigilance::HandleAfterApply().

◆ ModSpellCastTime()

void Unit::ModSpellCastTime ( SpellInfo const *  spellProto,
int32 castTime,
Spell spell = nullptr 
)
Todo:
:(MadAgos) Eventually check and delete the bool argument
14901{
14902 if (!spellInfo || castTime < 0)
14903 return;
14904
14905 if (spellInfo->IsChanneled() && spellInfo->HasAura(SPELL_AURA_MOUNTED))
14906 return;
14907
14908 // called from caster
14909 if (Player* modOwner = GetSpellModOwner())
14911 modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell, bool(modOwner != this && !IsPet()));
14912
14913 switch (spellInfo->DmgClass)
14914 {
14916 if (spellInfo->AttributesEx5 & SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC) // required double check
14917 castTime = int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
14918 else if (spellInfo->SpellVisual[0] == 3881 && HasAura(67556)) // cooking with Chef Hat.
14919 castTime = 500;
14920 break;
14922 break; // no known cases
14924 castTime = CanInstantCast() ? 0 : int32(float(castTime) * GetFloatValue(UNIT_MOD_CAST_SPEED));
14925 break;
14927 castTime = int32(float(castTime) * m_modAttackSpeedPct[RANGED_ATTACK]);
14928 break;
14929 default:
14930 break;
14931 }
14932}
@ SPELLMOD_CASTING_TIME
Definition: SpellDefines.h:87
@ SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC
Definition: SharedDefines.h:580
bool CanInstantCast() const
Definition: Unit.h:1780

References SpellInfo::AttributesEx5, CanInstantCast(), SpellInfo::DmgClass, Object::GetFloatValue(), GetSpellModOwner(), SpellInfo::HasAura(), HasAura(), SpellInfo::Id, SpellInfo::IsChanneled(), IsPet(), m_modAttackSpeedPct, RANGED_ATTACK, SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC, SPELL_AURA_MOUNTED, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLMOD_CASTING_TIME, SpellInfo::SpellVisual, and UNIT_MOD_CAST_SPEED.

Referenced by SpellInfo::CalcCastTime().

◆ ModSpellDuration()

int32 Unit::ModSpellDuration ( SpellInfo const *  spellProto,
Unit const *  target,
int32  duration,
bool  positive,
uint32  effectMask 
)
14801{
14802 // don't mod permanent auras duration
14803 if (duration < 0)
14804 return duration;
14805
14806 // some auras are not affected by duration modifiers
14807 if (spellProto->HasAttribute(SPELL_ATTR7_NO_TARGET_DURATION_MOD))
14808 return duration;
14809
14810 // cut duration only of negative effects
14811 // xinef: also calculate self casts, spell can be reflected for example
14812 if (!positive)
14813 {
14814 int32 mechanic = spellProto->GetSpellMechanicMaskByEffectMask(effectMask);
14815
14816 int32 durationMod;
14817 int32 durationMod_always = 0;
14818 int32 durationMod_not_stack = 0;
14819
14820 for (uint8 i = 1; i <= MECHANIC_ENRAGED; ++i)
14821 {
14822 if (!(mechanic & 1 << i))
14823 continue;
14824
14825 // Xinef: spells affecting movement imparing effects should not reduce duration if disoriented mechanic is present
14826 if (i == MECHANIC_SNARE && (mechanic & (1 << MECHANIC_DISORIENTED)))
14827 continue;
14828
14829 // Find total mod value (negative bonus)
14830 int32 new_durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, i);
14831 // Find max mod (negative bonus)
14832 int32 new_durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, i);
14833 // Check if mods applied before were weaker
14834 if (new_durationMod_always < durationMod_always)
14835 durationMod_always = new_durationMod_always;
14836 if (new_durationMod_not_stack < durationMod_not_stack)
14837 durationMod_not_stack = new_durationMod_not_stack;
14838 }
14839
14840 // Select strongest negative mod
14841 if (durationMod_always > durationMod_not_stack)
14842 durationMod = durationMod_not_stack;
14843 else
14844 durationMod = durationMod_always;
14845
14846 if (durationMod != 0)
14847 AddPct(duration, durationMod);
14848
14849 // there are only negative mods currently
14850 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, spellProto->Dispel);
14851 durationMod_not_stack = target->GetMaxNegativeAuraModifierByMiscValue(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, spellProto->Dispel);
14852
14853 durationMod = 0;
14854 if (durationMod_always > durationMod_not_stack)
14855 durationMod += durationMod_not_stack;
14856 else
14857 durationMod += durationMod_always;
14858
14859 if (durationMod != 0)
14860 AddPct(duration, durationMod);
14861 }
14862 else
14863 {
14864 // else positive mods here, there are no currently
14865 // when there will be, change GetTotalAuraModifierByMiscValue to GetTotalPositiveAuraModifierByMiscValue
14866 }
14867
14868 // Glyphs which increase duration of selfcasted buffs
14869 if (target == this)
14870 {
14871 switch (spellProto->SpellFamilyName)
14872 {
14873 case SPELLFAMILY_DRUID:
14874 if (spellProto->SpellFamilyFlags[0] & 0x100)
14875 {
14876 // Glyph of Thorns
14877 if (AuraEffect* aurEff = GetAuraEffect(57862, 0))
14878 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14879 }
14880 break;
14882 if ((spellProto->SpellFamilyFlags[0] & 0x00000002) && spellProto->SpellIconID == 298)
14883 {
14884 // Glyph of Blessing of Might
14885 if (AuraEffect* aurEff = GetAuraEffect(57958, 0))
14886 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14887 }
14888 else if ((spellProto->SpellFamilyFlags[0] & 0x00010000) && spellProto->SpellIconID == 306)
14889 {
14890 // Glyph of Blessing of Wisdom
14891 if (AuraEffect* aurEff = GetAuraEffect(57979, 0))
14892 duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS;
14893 }
14894 break;
14895 }
14896 }
14897 return std::max(duration, 0);
14898}
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK
Definition: SpellAuraDefines.h:309
@ SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK
Definition: SpellAuraDefines.h:297
@ SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
Definition: SpellAuraDefines.h:308
@ SPELL_AURA_MECHANIC_DURATION_MOD
Definition: SpellAuraDefines.h:295
@ SPELL_ATTR7_NO_TARGET_DURATION_MOD
Definition: SharedDefines.h:642
@ MECHANIC_ENRAGED
Definition: SharedDefines.h:1356
@ MECHANIC_DISORIENTED
Definition: SharedDefines.h:1327
constexpr auto MINUTE
Definition: Common.h:46

References AddPct(), SpellInfo::Dispel, GetAuraEffect(), GetMaxNegativeAuraModifierByMiscValue(), SpellInfo::GetSpellMechanicMaskByEffectMask(), GetTotalAuraModifierByMiscValue(), SpellInfo::HasAttribute(), IN_MILLISECONDS, MECHANIC_DISORIENTED, MECHANIC_ENRAGED, MECHANIC_SNARE, MINUTE, SPELL_ATTR7_NO_TARGET_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD, SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL, SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK, SPELLFAMILY_DRUID, SPELLFAMILY_PALADIN, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, and SpellInfo::SpellIconID.

Referenced by Spell::DoSpellHitOnUnit(), and Spell::EffectInterruptCast().

◆ MonsterMoveWithSpeed()

◆ Mount()

void Unit::Mount ( uint32  mount,
uint32  vehicleId = 0,
uint32  creatureEntry = 0 
)
13401{
13402 if (mount)
13404
13406
13407 if (Player* player = ToPlayer())
13408 {
13409 sScriptMgr->AnticheatSetUnderACKmount(player);
13410
13411 // mount as a vehicle
13412 if (VehicleId)
13413 {
13414 if (CreateVehicleKit(VehicleId, creatureEntry))
13415 {
13416 GetVehicleKit()->Reset();
13417
13418 // Send others that we now have a vehicle
13420 data << GetPackGUID();
13421 data << uint32(VehicleId);
13422 SendMessageToSet(&data, true);
13423
13425 player->GetSession()->SendPacket(&data);
13426
13427 // mounts can also have accessories
13429 }
13430 }
13431
13432 // unsummon pet
13433 Pet* pet = player->GetPet();
13434 if (pet)
13435 {
13437 // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface
13438 if (bg && bg->isArena())
13440 else
13441 player->UnsummonPetTemporaryIfAny();
13442 }
13443
13444 // xinef: if we have charmed npc, stun him also
13445 if (Unit* charm = player->GetCharm())
13446 if (charm->GetTypeId() == TYPEID_UNIT)
13447 charm->SetUnitFlag(UNIT_FLAG_STUNNED);
13448
13449 WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
13450 data << GetPackGUID();
13451 data << uint32(GameTime::GetGameTime().count()); // Packet counter
13452 data << player->GetCollisionHeight();
13453 player->GetSession()->SendPacket(&data);
13454 }
13455
13457}
@ AURA_INTERRUPT_FLAG_MOUNT
Definition: SpellDefines.h:61
bool isArena() const
Definition: Battleground.h:396
bool CreateVehicleKit(uint32 id, uint32 creatureEntry)
Definition: Unit.cpp:18632
void Reset(bool evading=false)
Definition: Vehicle.cpp:116
void InstallAllAccessories(bool evading)
Definition: Vehicle.cpp:83

References AURA_INTERRUPT_FLAG_MOUNT, CreateVehicleKit(), Player::GetBattleground(), GetCharm(), GameTime::GetGameTime(), Object::GetPackGUID(), GetVehicleKit(), WorldPacket::Initialize(), Vehicle::InstallAllAccessories(), Battleground::isArena(), RemoveAurasWithInterruptFlags(), Vehicle::Reset(), WorldObject::SendMessageToSet(), SetUInt32Value(), SetUnitFlag(), SMSG_MOVE_SET_COLLISION_HGT, SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, SMSG_PLAYER_VEHICLE_DATA, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, UNIT_FIELD_MOUNTDISPLAYID, UNIT_FLAG_MOUNT, and UNIT_FLAG_STUNNED.

Referenced by AuraEffect::HandleAuraMounted(), spell_mount_check_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyMountCommand(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::InitializeAI(), boss_captain_skarloc::InitializeAI(), npc_lady_sylvanas_windrunner_bfu::npc_lady_sylvanas_windrunner_bfuAI::JustRespawned(), Creature::LoadCreaturesAddon(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), npc_scarlet_courier::npc_scarlet_courierAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_mandokir::boss_mandokirAI::Reset(), WorldSession::SendDoFlight(), and npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached().

◆ NearTeleportTo() [1/2]

void Unit::NearTeleportTo ( float  x,
float  y,
float  z,
float  orientation,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
19904{
19905 DisableSpline();
19906 if (IsPlayer())
19907 ToPlayer()->TeleportTo(GetMapId(), x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | (removeTransport ? 0 : TELE_TO_NOT_LEAVE_TRANSPORT) | TELE_TO_NOT_UNSUMMON_PET | (casting ? TELE_TO_SPELL : 0) | (vehicleTeleport ? TELE_TO_NOT_LEAVE_VEHICLE : 0) | (withPet ? TELE_TO_WITH_PET : 0));
19908 else
19909 {
19910 Position pos = {x, y, z, orientation};
19911 SendTeleportPacket(pos);
19912 UpdatePosition(x, y, z, orientation, true);
19915 }
19916}
@ TELE_TO_WITH_PET
Definition: Player.h:827
@ TELE_TO_NOT_LEAVE_VEHICLE
Definition: Player.h:826
@ TELE_TO_SPELL
Definition: Player.h:825
@ TELE_TO_NOT_LEAVE_COMBAT
Definition: Player.h:823
@ TELE_TO_NOT_UNSUMMON_PET
Definition: Player.h:824
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:822
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options=0, Unit *target=nullptr, bool newInstance=false)
Definition: Player.cpp:1329
void SendTeleportPacket(Position &pos)
Definition: Unit.cpp:19925
void UpdateObjectVisibility(bool forced=true, bool fromUpdate=false) override
Definition: Unit.cpp:19047
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:19944
void ReinitializeMovement()
Definition: MotionMaster.cpp:901

References DisableSpline(), WorldLocation::GetMapId(), GetMotionMaster(), Object::IsPlayer(), MotionMaster::ReinitializeMovement(), SendTeleportPacket(), TELE_TO_NOT_LEAVE_COMBAT, TELE_TO_NOT_LEAVE_TRANSPORT, TELE_TO_NOT_LEAVE_VEHICLE, TELE_TO_NOT_UNSUMMON_PET, TELE_TO_SPELL, TELE_TO_WITH_PET, Player::TeleportTo(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdatePosition().

◆ NearTeleportTo() [2/2]

void Unit::NearTeleportTo ( Position pos,
bool  casting = false,
bool  vehicleTeleport = false,
bool  withPet = false,
bool  removeTransport = false 
)
19899{
19900 NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), casting, vehicleTeleport, withPet, removeTransport);
19901}
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition: Unit.cpp:19898

References Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), and NearTeleportTo().

Referenced by boss_viscidus::DamageTaken(), npc_madrigosa::npc_madrigosaAI::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), Spell::EffectLeap(), Spell::EffectResurrectPet(), Spell::EffectStuck(), Spell::EffectSummonPet(), Spell::EffectTeleportUnits(), Spell::EffectTeleUnitsFaceCaster(), npc_giant_claw_tentacle::Emerge(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), UtherBatteredHiltEvent::Execute(), BattlegroundBE::HandleAreaTrigger(), BattlegroundDS::HandleAreaTrigger(), BattlegroundNA::HandleAreaTrigger(), BattlegroundRL::HandleAreaTrigger(), BattlegroundRV::HandleAreaTrigger(), spell_moroes_vanish::HandleDummy(), spell_class_call_handler::HandleOnHitRogue(), npc_echo_of_medivh::HandlePieceJustDied(), BattlegroundBE::HandlePlayerUnderMap(), BattlegroundDS::HandlePlayerUnderMap(), BattlegroundNA::HandlePlayerUnderMap(), BattlegroundRL::HandlePlayerUnderMap(), BattlegroundRV::HandlePlayerUnderMap(), npc_pet_mage_mirror_image::InitializeAI(), boss_urom::boss_uromAI::JustDied(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_grandmaster_vorpil::JustEngagedWith(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), NearTeleportTo(), npc_akama_illidan::npc_akama_illidanAI::npc_akama_illidanAI(), npc_ball_of_flame::npc_ball_of_flameAI::npc_ball_of_flameAI(), npc_chesspiece::OnCharmed(), npc_vh_sinclari::OnGossipSelect(), npc_cos_chromie_start::OnGossipSelect(), boss_gothik::boss_gothikAI::Reset(), Map::ScriptsProcess(), npc_midsummer_torch_target::SelectPosition(), npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame(), boss_urom::boss_uromAI::SpellHit(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_frostwing_vrykul::npc_frostwing_vrykulAI::SpellHitTarget(), npc_nerubian_burrower::npc_nerubian_burrowerAI::SpellHitTarget(), npc_pos_leader_second::npc_pos_leader_secondAI::SpellHitTarget(), boss_cyanigosa::boss_cyanigosaAI::SpellHitTarget(), BattlegroundRV::TeleportUnitToNewZ(), Vehicle::TeleportVehicle(), npc_doomfire_spirit::TryTeleportInDirection(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_coldflame::npc_coldflameAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), and npc_minigob_manabonk::UpdateAI().

◆ OutDebugInfo()

void Unit::OutDebugInfo ( ) const
20152{
20153 LOG_ERROR("entities.unit", "Unit::OutDebugInfo");
20154 LOG_INFO("entities.unit", "GUID {}, name {}", GetGUID().ToString(), GetName());
20155 LOG_INFO("entities.unit", "OwnerGUID {}, MinionGUID {}, CharmerGUID {}, CharmedGUID {}",
20157 LOG_INFO("entities.unit", "In world {}, unit type mask {}", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
20158 if (IsInWorld())
20159 LOG_INFO("entities.unit", "Mapid {}", GetMapId());
20160
20161 LOG_INFO("entities.unit", "Summon Slot: ");
20162 for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
20163 LOG_INFO("entities.unit", "{}, ", m_SummonSlot[i].ToString());
20164 LOG_INFO("server.loading", " ");
20165
20166 LOG_INFO("entities.unit", "Controlled List: ");
20167 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
20168 LOG_INFO("entities.unit", "{}, ", (*itr)->GetGUID().ToString());
20169 LOG_INFO("server.loading", " ");
20170
20171 LOG_INFO("entities.unit", "Aura List: ");
20172 for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr)
20173 LOG_INFO("entities.unit", "{}, ", itr->first);
20174 LOG_INFO("server.loading", " ");
20175
20176 if (IsVehicle())
20177 {
20178 LOG_INFO("entities.unit", "Passenger List: ");
20179 for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr)
20180 if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid))
20181 LOG_INFO("entities.unit", "{}, ", passenger->GetGUID().ToString());
20182 LOG_INFO("server.loading", " ");
20183 }
20184
20185 if (GetVehicle())
20186 LOG_INFO("entities.unit", "On vehicle {}.", GetVehicleBase()->GetEntry());
20187}
Seats
Definition: boss_flame_leviathan.cpp:167

References GetCharmerGUID(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldLocation::GetMapId(), GetMinionGUID(), WorldObject::GetName(), GetOwnerGUID(), ObjectAccessor::GetUnit(), GetVehicle(), GetVehicleBase(), GetVehicleKit(), Object::IsInWorld(), IsVehicle(), LOG_ERROR, LOG_INFO, m_appliedAuras, m_Controlled, m_SummonSlot, m_unitTypeMask, MAX_SUMMON_SLOT, and Position::ToString().

Referenced by SetMinion().

◆ PatchValuesUpdate()

void Unit::PatchValuesUpdate ( ByteBuffer valuesUpdateBuf,
BuildValuesCachePosPointers posPointers,
Player target 
)
private
20750{
20751 Creature const* creature = ToCreature();
20752
20753 // UNIT_NPC_FLAGS
20754 if (creature && posPointers.UnitNPCFlagsPos >= 0)
20755 {
20756 uint32 appendValue = m_uint32Values[UNIT_NPC_FLAGS];
20757
20758 if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && appendValue & UNIT_NPC_FLAG_FLIGHTMASTER)
20759 appendValue |= UNIT_NPC_FLAG_GOSSIP; // flight masters need NPC gossip flag to show instant flight toggle option
20760
20761 if (!target->CanSeeSpellClickOn(creature))
20762 appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
20763
20764 if (!target->CanSeeVendor(creature))
20765 appendValue &= ~UNIT_NPC_FLAG_VENDOR_MASK;
20766
20767 if (!creature->IsValidTrainerForPlayer(target, &appendValue))
20768 appendValue &= ~UNIT_NPC_FLAG_TRAINER;
20769
20770 valuesUpdateBuf.put(posPointers.UnitNPCFlagsPos, appendValue);
20771 }
20772
20773 // UNIT_FIELD_AURASTATE
20774 if (posPointers.UnitFieldAuraStatePos >= 0)
20775 valuesUpdateBuf.put(posPointers.UnitFieldAuraStatePos, uint32(BuildAuraStateUpdateForTarget(target)));
20776
20777 // UNIT_FIELD_FLAGS
20778 if (posPointers.UnitFieldFlagsPos >= 0)
20779 {
20780 uint32 appendValue = m_uint32Values[UNIT_FIELD_FLAGS];
20781 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
20782 appendValue &= ~UNIT_FLAG_NOT_SELECTABLE;
20783
20784 valuesUpdateBuf.put(posPointers.UnitFieldFlagsPos, appendValue);
20785 }
20786
20787 // UNIT_FIELD_DISPLAYID
20788 // Use modelid_a if not gm, _h if gm for CREATURE_FLAG_EXTRA_TRIGGER creatures.
20789 if (posPointers.UnitFieldDisplayPos >= 0)
20790 {
20792 if (creature)
20793 {
20794 CreatureTemplate const* cinfo = creature->GetCreatureTemplate();
20795
20796 // this also applies for transform auras
20797 if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(getTransForm()))
20798 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
20799 if (transform->Effects[i].IsAura(SPELL_AURA_TRANSFORM))
20800 if (CreatureTemplate const* transformInfo = sObjectMgr->GetCreatureTemplate(transform->Effects[i].MiscValue))
20801 {
20802 cinfo = transformInfo;
20803 break;
20804 }
20805
20807 {
20808 if (target->IsGameMaster() && target->GetSession()->IsGMAccount())
20809 {
20810 displayId = cinfo->GetFirstVisibleModel()->CreatureDisplayID;
20811 }
20812 else
20813 {
20814 displayId = cinfo->GetFirstInvisibleModel()->CreatureDisplayID;
20815 }
20816 }
20817 }
20818
20819 valuesUpdateBuf.put(posPointers.UnitFieldDisplayPos, uint32(displayId));
20820 }
20821
20822 // UNIT_DYNAMIC_FLAGS
20823 // Hide lootable animation for unallowed players.
20824 if (posPointers.UnitDynamicFlagsPos >= 0)
20825 {
20827
20828 if (creature)
20829 {
20830 if (creature->hasLootRecipient())
20831 {
20832 dynamicFlags |= UNIT_DYNFLAG_TAPPED;
20833 if (creature->isTappedBy(target))
20834 dynamicFlags |= UNIT_DYNFLAG_TAPPED_BY_PLAYER;
20835 }
20836
20837 if (!target->isAllowedToLoot(creature))
20838 dynamicFlags &= ~UNIT_DYNFLAG_LOOTABLE;
20839 }
20840
20841 // unit UNIT_DYNFLAG_TRACK_UNIT should only be sent to caster of SPELL_AURA_MOD_STALKED auras
20842 if (dynamicFlags & UNIT_DYNFLAG_TRACK_UNIT)
20844 dynamicFlags &= ~UNIT_DYNFLAG_TRACK_UNIT;
20845
20846 valuesUpdateBuf.put(posPointers.UnitDynamicFlagsPos, dynamicFlags);
20847 }
20848
20849 // UNIT_FIELD_BYTES_2
20850 if (posPointers.UnitFieldBytes2Pos >= 0)
20851 {
20852 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
20853 {
20855 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
20856 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
20857 // Allow targetting opposite faction in party when enabled in config
20858 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8))); // this flag is at uint8 offset 1 !!
20859 }// pussywizard / Callmephil
20860 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
20861 (this->IsPlayer() || this->GetTypeId() == TYPEID_UNIT || this->IsDynamicObject()))
20862 {
20863 valuesUpdateBuf.put(posPointers.UnitFieldBytes2Pos, (m_uint32Values[UNIT_FIELD_BYTES_2] & 0xFFFFF2FF)); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
20864 }
20865 }
20866
20867 // UNIT_FIELD_FACTIONTEMPLATE
20868 if (posPointers.UnitFieldFactionTemplatePos >= 0)
20869 {
20870 if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
20871 {
20873 FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
20874 if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
20875 // pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
20876 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
20877 }// pussywizard / Callmephil
20878 else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
20879 (this->IsPlayer() || this->GetTypeId() == TYPEID_UNIT || this->IsDynamicObject()))
20880 {
20881 valuesUpdateBuf.put(posPointers.UnitFieldFactionTemplatePos, uint32(target->GetFaction()));
20882 }
20883 }
20884
20885 sScriptMgr->OnPatchValuesUpdate(this, valuesUpdateBuf, posPointers, target);
20886}
@ CREATURE_FLAG_EXTRA_TRIGGER
Definition: CreatureData.h:53
@ CONFIG_INSTANT_TAXI
Definition: IWorld.h:386
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition: IWorld.h:80
@ UNIT_DYNFLAG_TRACK_UNIT
Definition: SharedDefines.h:3122
bool IsValidTrainerForPlayer(Player *player, uint32 *npcFlags=nullptr) const
Definition: Creature.cpp:1258
bool isTappedBy(Player const *player) const
Definition: Creature.cpp:1374
uint32 CreatureDisplayID
Definition: CreatureData.h:182
CreatureModel const * GetFirstInvisibleModel() const
Definition: Creature.cpp:162
CreatureModel const * GetFirstVisibleModel() const
Definition: Creature.cpp:172
bool isAllowedToLoot(Creature const *creature)
Definition: PlayerStorage.cpp:5635
bool CanSeeVendor(Creature const *creature) const
Definition: Player.cpp:14249
bool IsSpectator() const
Definition: Player.h:2552
bool CanSeeSpellClickOn(Creature const *creature) const
Definition: Player.cpp:14226
uint32 BuildAuraStateUpdateForTarget(Unit *target) const
Definition: Unit.cpp:10476
int32 UnitFieldFlagsPos
Definition: UnitUtils.h:99
int32 UnitFieldDisplayPos
Definition: UnitUtils.h:100
int32 UnitDynamicFlagsPos
Definition: UnitUtils.h:101
int32 UnitFieldAuraStatePos
Definition: UnitUtils.h:98
int32 UnitFieldFactionTemplatePos
Definition: UnitUtils.h:103
int32 UnitFieldBytes2Pos
Definition: UnitUtils.h:102
int32 UnitNPCFlagsPos
Definition: UnitUtils.h:97
bool IsGMAccount() const
Definition: WorldSession.cpp:181
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:137

References BuildAuraStateUpdateForTarget(), Player::CanSeeSpellClickOn(), Player::CanSeeVendor(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, CONFIG_INSTANT_TAXI, CREATURE_FLAG_EXTRA_TRIGGER, CreatureModel::CreatureDisplayID, WorldObject::FindMap(), CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetFaction(), GetFactionTemplateEntry(), CreatureTemplate::GetFirstInvisibleModel(), CreatureTemplate::GetFirstVisibleModel(), Object::GetGUID(), Player::GetSession(), getTransForm(), HasAuraTypeWithCaster(), Creature::hasLootRecipient(), Player::isAllowedToLoot(), Map::IsBattleArena(), IsControlledByPlayer(), FactionTemplateEntry::IsFriendlyTo(), Player::IsGameMaster(), WorldSession::IsGMAccount(), IsInRaidWith(), Player::IsSpectator(), Creature::isTappedBy(), Creature::IsValidTrainerForPlayer(), Object::m_uint32Values, MAX_SPELL_EFFECTS, ByteBuffer::put(), sObjectMgr, SPELL_AURA_MOD_STALKED, SPELL_AURA_TRANSFORM, sScriptMgr, sSpellMgr, sWorld, Object::ToCreature(), TYPEID_UNIT, UNIT_BYTE2_FLAG_SANCTUARY, UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE, UNIT_DYNFLAG_TAPPED, UNIT_DYNFLAG_TAPPED_BY_PLAYER, UNIT_DYNFLAG_TRACK_UNIT, UNIT_FIELD_BYTES_2, UNIT_FIELD_DISPLAYID, UNIT_FIELD_FLAGS, UNIT_NPC_FLAG_FLIGHTMASTER, UNIT_NPC_FLAG_GOSSIP, UNIT_NPC_FLAGS, BuildValuesCachePosPointers::UnitDynamicFlagsPos, BuildValuesCachePosPointers::UnitFieldAuraStatePos, BuildValuesCachePosPointers::UnitFieldBytes2Pos, BuildValuesCachePosPointers::UnitFieldDisplayPos, BuildValuesCachePosPointers::UnitFieldFactionTemplatePos, BuildValuesCachePosPointers::UnitFieldFlagsPos, and BuildValuesCachePosPointers::UnitNPCFlagsPos.

Referenced by BuildValuesUpdate().

◆ PauseMovement()

void Unit::PauseMovement ( uint32  timer = 0,
uint8  slot = 0 
)
virtual

Disable the unit movement by clearing UNIT_STATE_MOVING and stopping the spline.

16598{
16599 if (slot >= MAX_MOTION_SLOT)
16600 return;
16601
16602 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
16603 movementGenerator->Pause(timer);
16604
16605 StopMoving();
16606}
@ MAX_MOTION_SLOT
Definition: MotionMaster.h:64
void StopMoving()
Definition: Unit.cpp:16578
Definition: MovementGenerator.h:30

References GetMotionMaster(), MAX_MOTION_SLOT, and StopMoving().

Referenced by WorldSession::HandleBattlemasterHelloOpcode(), WorldSession::HandleGossipHelloOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::SendListInventory(), and boss_shade_of_aran::SetGUID().

◆ PetSpellFail()

void Unit::PetSpellFail ( SpellInfo const *  spellInfo,
Unit target,
uint32  result 
)
20248{
20249 CharmInfo* charmInfo = GetCharmInfo();
20250 if (!charmInfo || GetTypeId() != TYPEID_UNIT)
20251 return;
20252
20254 {
20255 if ((result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE) || !ToCreature()->HasReactState(REACT_PASSIVE))
20256 if (Unit* owner = GetOwner())
20257 {
20258 if (spellInfo->IsPositive() && IsFriendlyTo(target))
20259 {
20260 AttackStop();
20261 charmInfo->SetIsAtStay(false);
20262 charmInfo->SetIsCommandAttack(true);
20263 charmInfo->SetIsReturning(false);
20264 charmInfo->SetIsFollowing(false);
20265
20266 GetMotionMaster()->MoveFollow(target, PET_FOLLOW_DIST, rand_norm() * 2 * M_PI);
20267 }
20268 else if (owner->IsValidAttackTarget(target))
20269 {
20270 AttackStop();
20271 charmInfo->SetIsAtStay(false);
20272 charmInfo->SetIsCommandAttack(true);
20273 charmInfo->SetIsReturning(false);
20274 charmInfo->SetIsFollowing(false);
20275
20276 if (!ToCreature()->HasReactState(REACT_PASSIVE))
20277 ToCreature()->AI()->AttackStart(target);
20278 else
20279 GetMotionMaster()->MoveChase(target);
20280 }
20281 }
20282
20283 // can be extended in future
20284 if (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE)
20285 {
20286 charmInfo->SetForcedSpell(spellInfo->IsPositive() ? -int32(spellInfo->Id) : spellInfo->Id);
20287 charmInfo->SetForcedTargetGUID(target->GetGUID());
20288 }
20289 else
20290 {
20291 charmInfo->SetForcedSpell(0);
20293 }
20294 }
20295}
#define PET_FOLLOW_DIST
Definition: PetDefines.h:198
@ SPELL_FAILED_OUT_OF_RANGE
Definition: SharedDefines.h:1046
@ SPELL_FAILED_LINE_OF_SIGHT
Definition: SharedDefines.h:996
bool IsPathfindingEnabled(const Map *map)
Definition: DisableMgr.cpp:411
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
void SetIsAtStay(bool val)
Definition: CharmInfo.cpp:372
void SetIsFollowing(bool val)
Definition: CharmInfo.cpp:382
void SetIsReturning(bool val)
Definition: CharmInfo.cpp:392
void SetForcedSpell(uint32 id)
Definition: CharmInfo.h:175
void SetForcedTargetGUID(ObjectGuid guid=ObjectGuid::Empty)
Definition: CharmInfo.h:177
void SetIsCommandAttack(bool val)
Definition: CharmInfo.cpp:310
void MoveChase(Unit *target, std::optional< ChaseRange > dist={}, std::optional< ChaseAngle > angle={})
Force the unit to chase this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:313
void MoveFollow(Unit *target, float dist, float angle, MovementSlot slot=MOTION_SLOT_ACTIVE, bool inheritWalkState=true)
The unit will follow this target. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:409

References Creature::AI(), UnitAI::AttackStart(), AttackStop(), ObjectGuid::Empty, GetCharmInfo(), Object::GetGUID(), WorldObject::GetMap(), GetMotionMaster(), GetOwner(), Object::GetTypeId(), SpellInfo::Id, IsFriendlyTo(), DisableMgr::IsPathfindingEnabled(), SpellInfo::IsPositive(), MotionMaster::MoveChase(), MotionMaster::MoveFollow(), PET_FOLLOW_DIST, rand_norm(), REACT_PASSIVE, CharmInfo::SetForcedSpell(), CharmInfo::SetForcedTargetGUID(), CharmInfo::SetIsAtStay(), CharmInfo::SetIsCommandAttack(), CharmInfo::SetIsFollowing(), CharmInfo::SetIsReturning(), SPELL_FAILED_LINE_OF_SIGHT, SPELL_FAILED_OUT_OF_RANGE, Object::ToCreature(), and TYPEID_UNIT.

Referenced by WorldSession::HandlePetActionHelper(), and WorldSession::HandlePetCastSpellOpcode().

◆ ProcDamageAndSpell()

void Unit::ProcDamageAndSpell ( Unit actor,
Unit victim,
uint32  procAttacker,
uint32  procVictim,
uint32  procEx,
uint32  amount,
WeaponAttackType  attType = BASE_ATTACK,
SpellInfo const *  procSpellInfo = nullptr,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
static
6330{
6331 // Not much to do if no flags are set.
6332 if (procAttacker && actor)
6333 actor->ProcDamageAndSpellFor(false, victim, procAttacker, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6334 // Now go on with a victim's events'n'auras
6335 // Not much to do if no flags are set or there is no victim
6336 if (victim && victim->IsAlive() && procVictim)
6337 victim->ProcDamageAndSpellFor(true, actor, procVictim, procExtra, attType, procSpellInfo, amount, procAura, procAuraEffectIndex, procSpell, damageInfo, healInfo, procPhase);
6338}

References IsAlive(), and ProcDamageAndSpellFor().

Referenced by Spell::_cast(), Spell::_handle_finish_phase(), AttackerStateUpdate(), Spell::DoAllEffectOnTarget(), ReflectEvent::Execute(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), and Kill().

◆ ProcDamageAndSpellFor()

void Unit::ProcDamageAndSpellFor ( bool  isVictim,
Unit target,
uint32  procFlag,
uint32  procExtra,
WeaponAttackType  attType,
SpellInfo const *  procSpellInfo,
uint32  damage,
SpellInfo const *  procAura = nullptr,
int8  procAuraEffectIndex = -1,
Spell const *  procSpell = nullptr,
DamageInfo damageInfo = nullptr,
HealInfo healInfo = nullptr,
uint32  procPhase = 2 
)
15983{
15984 // Player is loaded now - do not allow passive spell casts to proc
15985 if (IsPlayer() && ToPlayer()->GetSession()->PlayerLoading())
15986 return;
15987 // For melee/ranged based attack need update skills and set some Aura states if victim present
15988 if (procFlag & MELEE_BASED_TRIGGER_MASK && target && procPhase == PROC_SPELL_PHASE_HIT)
15989 {
15990 // Xinef: Shaman in ghost wolf form cant proc anything melee based
15991 if (!isVictim && GetShapeshiftForm() == FORM_GHOSTWOLF)
15992 return;
15993
15994 // Update skills here for players
15995 // only when you are not fighting other players or their pets/totems (pvp)
15996 if (IsPlayer() && !target->IsCharmedOwnedByPlayerOrPlayer())
15997 {
15998 // On melee based hit/miss/resist/parry/dodge need to update skill (for victim and attacker)
16000 {
16001 ToPlayer()->UpdateCombatSkills(target, attType, isVictim, procSpell ? procSpell->m_weaponItem : nullptr);
16002 }
16003 // Update defence if player is victim and we block - TODO: confirm that blocked attacks only have a chance to increase defence skill
16004 else if (isVictim && procExtra & (PROC_EX_BLOCK))
16005 {
16006 ToPlayer()->UpdateCombatSkills(target, attType, true);
16007 }
16008 }
16009 // If exist crit/parry/dodge/block need update aura state (for victim and attacker)
16011 {
16012 // for victim
16013 if (isVictim)
16014 {
16015 // if victim and dodge attack
16016 if (procExtra & PROC_EX_DODGE)
16017 {
16018 // Update AURA_STATE on dodge
16019 if (!IsClass(CLASS_ROGUE, CLASS_CONTEXT_ABILITY_REACTIVE)) // skip Rogue Riposte
16020 {
16023 }
16024 }
16025 // if victim and parry attack
16026 if (procExtra & PROC_EX_PARRY)
16027 {
16028 // For Hunters only Counterattack (skip Mongoose bite)
16030 {
16033 }
16034 else
16035 {
16038 }
16039 }
16040 // if and victim block attack
16041 if (procExtra & PROC_EX_BLOCK)
16042 {
16045 }
16046 }
16047 else // For attacker
16048 {
16049 // Overpower on victim dodge
16050 if (procExtra & PROC_EX_DODGE)
16051 {
16053 {
16054 AddComboPoints(target, 1);
16056 }
16057 }
16058
16059 // Wolverine Bite
16060 if ((procExtra & PROC_HIT_CRITICAL) && IsHunterPet())
16061 {
16062 AddComboPoints(target, 1);
16064 }
16065 }
16066 }
16067 }
16068
16069 Unit* actor = isVictim ? target : this;
16070 Unit* actionTarget = !isVictim ? target : this;
16071
16072 ProcEventInfo eventInfo = ProcEventInfo(actor, actionTarget, target, procFlag, 0, procPhase, procExtra, procSpell, damageInfo, healInfo, procAura, procAuraEffectIndex);
16073
16074 ProcTriggeredList procTriggered;
16075 // Fill procTriggered list
16076 for (AuraApplicationMap::const_iterator itr = GetAppliedAuras().begin(); itr != GetAppliedAuras().end(); ++itr)
16077 {
16078 // Do not allow auras to proc from effect triggered by itself
16079 if (procAura && procAura->Id == itr->first)
16080 continue;
16081
16082 // Xinef: Generic Item Equipment cooldown, -1 is a special marker
16083 if (itr->second->GetBase()->GetCastItemGUID() && HasSpellItemCooldown(itr->first, uint32(-1)))
16084 continue;
16085
16086 ProcTriggeredData triggerData(itr->second->GetBase());
16087 // Defensive procs are active on absorbs (so absorption effects are not a hindrance)
16088 bool active = damage || (procExtra & PROC_EX_BLOCK && isVictim);
16089 if (isVictim)
16090 procExtra &= ~PROC_EX_INTERNAL_REQ_FAMILY;
16091
16092 SpellInfo const* spellProto = itr->second->GetBase()->GetSpellInfo();
16093
16094 // only auras that have trigger spell should proc from fully absorbed damage
16095 if (procExtra & PROC_EX_ABSORB && isVictim)
16096 if (damage || spellProto->Effects[EFFECT_0].TriggerSpell || spellProto->Effects[EFFECT_1].TriggerSpell || spellProto->Effects[EFFECT_2].TriggerSpell)
16097 active = true;
16098
16099 // xinef: fix spell procing from damaging / healing casts if spell has DoT / HoT effect only
16100 // only player spells are taken into account
16101 if (!active && !isVictim && !(procFlag & PROC_FLAG_DONE_PERIODIC) && procSpellInfo && procSpellInfo->SpellFamilyName && (procSpellInfo->HasAura(SPELL_AURA_PERIODIC_DAMAGE) || procSpellInfo->HasAura(SPELL_AURA_PERIODIC_HEAL)))
16102 active = true;
16103
16104 // AuraScript Hook
16105 if (!triggerData.aura->CallScriptCheckProcHandlers(itr->second, eventInfo))
16106 {
16107 continue;
16108 }
16109
16110 bool isTriggeredAtSpellProcEvent = IsTriggeredAtSpellProcEvent(target, triggerData.aura, attType, isVictim, active, triggerData.spellProcEvent, eventInfo);
16111
16112 // AuraScript Hook
16113 if (!triggerData.aura->CallScriptAfterCheckProcHandlers(itr->second, eventInfo, isTriggeredAtSpellProcEvent))
16114 {
16115 continue;
16116 }
16117
16118 // do checks using conditions table
16119 ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL_PROC, spellProto->Id);
16120 ConditionSourceInfo condInfo = ConditionSourceInfo(eventInfo.GetActor(), eventInfo.GetActionTarget());
16121 if (!sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
16122 {
16123 continue;
16124 }
16125
16126 // Triggered spells not triggering additional spells
16127 //bool triggered = !spellProto->HasAttribute(SPELL_ATTR3_CAN_PROC_FROM_PROCS) ?
16128 // (procExtra & PROC_EX_INTERNAL_TRIGGERED && !(procFlag & PROC_FLAG_DONE_TRAP_ACTIVATION)) : false;
16129
16130 bool hasTriggeredProc = false;
16131 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
16132 {
16133 if (itr->second->HasEffect(i))
16134 {
16135 AuraEffect* aurEff = itr->second->GetBase()->GetEffect(i);
16136
16137 // Skip this auras
16138 if (isNonTriggerAura[aurEff->GetAuraType()])
16139 continue;
16140
16141 // If not trigger by default and spellProcEvent == nullptr - skip
16142 if (!isTriggerAura[aurEff->GetAuraType()] && !triggerData.spellProcEvent)
16143 continue;
16144
16145 switch (aurEff->GetAuraType())
16146 {
16149 case SPELL_AURA_DUMMY:
16151 if (uint32 triggerSpellId = aurEff->GetSpellInfo()->Effects[i].TriggerSpell)
16152 {
16153 triggerData.triggerSpelId[i] = triggerSpellId;
16154 hasTriggeredProc = true;
16155 }
16156 break;
16157 default:
16158 break;
16159 }
16160
16161 // Some spells must always trigger
16162 //if (isAlwaysTriggeredAura[aurEff->GetAuraType()])
16163 triggerData.effMask |= 1 << i;
16164 }
16165 }
16166
16167 if (triggerData.effMask)
16168 {
16169 // If there is aura that triggers another proc aura, make sure that the triggered one is going to be proccessed on top of it
16170 if (hasTriggeredProc)
16171 {
16172 bool proccessed = false;
16173 for (uint8 i = 0; i < EFFECT_ALL; ++i)
16174 {
16175 if (uint32 triggeredSpellId = triggerData.triggerSpelId[i])
16176 {
16177 auto iter = std::find(procTriggered.begin(), procTriggered.end(), triggeredSpellId);
16178 if (iter != procTriggered.end())
16179 {
16180 std::advance(iter, 1);
16181 procTriggered.insert(iter, triggerData);
16182 proccessed = true;
16183 break;
16184 }
16185 }
16186 }
16187
16188 if (!proccessed)
16189 {
16190 procTriggered.push_front(triggerData);
16191 }
16192 }
16193 else
16194 {
16195 procTriggered.push_front(triggerData);
16196 }
16197 }
16198 }
16199
16200 // Nothing found
16201 if (procTriggered.empty())
16202 return;
16203
16204 // Note: must SetCantProc(false) before return
16206 SetCantProc(true);
16207
16208 // Handle effects proceed this time
16209 for (ProcTriggeredList::const_iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
16210 {
16211 // look for aura in auras list, it may be removed while proc event processing
16212 if (i->aura->IsRemoved())
16213 continue;
16214
16215 bool useCharges = i->aura->IsUsingCharges();
16216 // no more charges to use, prevent proc
16217 if (useCharges && !i->aura->GetCharges())
16218 continue;
16219
16220 bool takeCharges = false;
16221 SpellInfo const* spellInfo = i->aura->GetSpellInfo();
16222
16223 AuraApplication* aurApp = i->aura->GetApplicationOfTarget(GetGUID());
16224
16225 bool prepare = i->aura->CallScriptPrepareProcHandlers(aurApp, eventInfo);
16226
16227 // For players set spell cooldown if need
16228 uint32 cooldown = 0;
16229 if (prepare && i->spellProcEvent && i->spellProcEvent->cooldown)
16230 cooldown = i->spellProcEvent->cooldown;
16231
16232 // Xinef: set cooldown for actual proc
16233 eventInfo.SetProcCooldown(cooldown);
16234
16235 // Note: must SetCantProc(false) before return
16237 SetCantProc(true);
16238
16239 bool handled = i->aura->CallScriptProcHandlers(aurApp, eventInfo);
16240
16241 // "handled" is needed as long as proc can be handled in multiple places
16242 if (!handled && HandleAuraProc(target, damage, i->aura, procSpellInfo, procFlag, procExtra, cooldown, &handled))
16243 {
16244 uint32 Id = i->aura->GetId();
16245 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered with value by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), Id);
16246 takeCharges = true;
16247 }
16248
16249 if (!handled)
16250 for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
16251 {
16252 if (!(i->effMask & (1 << effIndex)))
16253 continue;
16254
16255 AuraEffect* triggeredByAura = i->aura->GetEffect(effIndex);
16256 ASSERT(triggeredByAura);
16257
16258 bool prevented = i->aura->CallScriptEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
16259 if (prevented)
16260 {
16261 takeCharges = true;
16262 continue;
16263 }
16264
16265 switch (triggeredByAura->GetAuraType())
16266 {
16268 {
16269 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16270 // Don`t drop charge or add cooldown for not started trigger
16271 if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procPhase, eventInfo))
16272 takeCharges = true;
16273 break;
16274 }
16276 {
16277 // target has to be valid
16278 if (!eventInfo.GetProcTarget())
16279 break;
16280
16281 triggeredByAura->HandleProcTriggerDamageAuraProc(aurApp, eventInfo); // this function is part of the new proc system
16282 takeCharges = true;
16283 break;
16284 }
16286 case SPELL_AURA_DUMMY:
16287 {
16288 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} dummy aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16289 if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, eventInfo))
16290 takeCharges = true;
16291 break;
16292 }
16297 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} aura of spell {})", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId());
16298 takeCharges = true;
16299 break;
16301 {
16302 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id {} (triggered by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16303 if (HandleOverrideClassScriptAuraProc(target, damage, triggeredByAura, procSpellInfo, cooldown))
16304 takeCharges = true;
16305 break;
16306 }
16308 {
16309 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by {} dummy aura of spell {})",
16310 (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16311 if (damage > 0)
16312 {
16314 takeCharges = true;
16315 }
16316 break;
16317 }
16319 {
16320 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by {} dummy aura of spell {})",
16321 (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16322 HandleAuraRaidProcFromCharge(triggeredByAura);
16323 takeCharges = true;
16324 break;
16325 }
16327 {
16328 LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell {} (triggered with value by {} aura of spell {})", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId());
16329
16330 if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpellInfo, procFlag, procExtra, cooldown, procPhase, eventInfo))
16331 takeCharges = true;
16332 break;
16333 }
16335 // Skip melee hits or instant cast spells
16336 // xinef: check channeled spells which are affected by haste also
16337 if (procSpellInfo && (procSpellInfo->SpellFamilyName || GetTypeId() != TYPEID_PLAYER) &&
16338 (procSpellInfo->CalcCastTime() > 0 /*||
16339 (procSpell->IsChanneled() && procSpell->GetDuration() > 0 && (HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, procSpell) || procSpell->HasAttribute(SPELL_ATTR5_SPELL_HASTE_AFFECTS_PERIODIC)))*/))
16340 takeCharges = true;
16341 break;
16343 // Skip Melee hits and spells ws wrong school
16344 if (procSpellInfo && (triggeredByAura->GetMiscValue() & procSpellInfo->SchoolMask)) // School check
16345 takeCharges = true;
16346 break;
16348 // Skip Melee hits and targets with magnet aura
16349 if (procSpellInfo && (triggeredByAura->GetBase()->GetUnitOwner()->ToUnit() == ToUnit())) // Magnet
16350 takeCharges = true;
16351 break;
16354 // Skip melee hits and spells ws wrong school or zero cost
16355 if (procSpellInfo &&
16356 (procSpellInfo->ManaCost != 0 || procSpellInfo->ManaCostPercentage != 0 || (procSpellInfo->SpellFamilyFlags[1] & 0x2)) && // Cost check, mutilate include
16357 (triggeredByAura->GetMiscValue() & procSpellInfo->SchoolMask)) // School check
16358 takeCharges = true;
16359 break;
16362 // Compare mechanic
16363 if (procSpellInfo && procSpellInfo->Mechanic == uint32(triggeredByAura->GetMiscValue()))
16364 takeCharges = true;
16365 break;
16367 // Compare casters
16368 if (target && triggeredByAura->GetCasterGUID() == target->GetGUID())
16369 takeCharges = true;
16370 break;
16371 // CC Auras which use their amount amount to drop
16372 // Are there any more auras which need this?
16378 {
16379 // Spell own direct damage at apply wont break the CC
16380 // Xinef: Or when the aura is at full duration (assume that such auras should be added at the end, skipping all damage procs etc.)
16381 if (procSpellInfo)
16382 if ((!i->aura->IsPermanent() && i->aura->GetDuration() == i->aura->GetMaxDuration()) || procSpellInfo->Id == triggeredByAura->GetId() ||
16383 procSpellInfo->HasAttribute(SPELL_ATTR4_REACTIVE_DAMAGE_PROC))
16384 break;
16385
16386 // chargeable mods are breaking on hit
16387 if (useCharges)
16388 takeCharges = true;
16389 else if (triggeredByAura->GetAmount()) // aura must have amount
16390 {
16391 int32 damageLeft = triggeredByAura->GetAmount();
16392 // No damage left
16393 if (damageLeft < int32(damage))
16394 i->aura->Remove();
16395 else
16396 triggeredByAura->SetAmount(damageLeft - damage);
16397 }
16398 break;
16399 }
16401 if (procSpellInfo && procSpellInfo->Id == 20647) // hack for warriors execute, both dummy and damage spell are affected by ignore aurastate aura
16402 break;
16403 takeCharges = true;
16404 break;
16407 {
16408 if (triggeredByAura->GetSpellModifier())
16409 {
16410 // Do proc if mod is consumed by spell
16411 if (!procSpell || procSpell->m_appliedMods.find(i->aura) != procSpell->m_appliedMods.end())
16412 {
16413 takeCharges = true;
16414 }
16415 }
16416 break;
16417 }
16418 default:
16419 takeCharges = true;
16420 break;
16421 }
16422 i->aura->CallScriptAfterEffectProcHandlers(triggeredByAura, aurApp, eventInfo);
16423 }
16424 // Remove charge (aura can be removed by triggers)
16425 // xinef: take into account attribute6 of proc spell
16426 if (prepare && useCharges && takeCharges)
16427 if (!procSpellInfo || isVictim || !procSpellInfo->HasAttribute(SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES))
16428 i->aura->DropCharge();
16429
16430 i->aura->CallScriptAfterProcHandlers(aurApp, eventInfo);
16431
16433 SetCantProc(false);
16434 }
16435
16436 // Cleanup proc requirements
16438 SetCantProc(false);
16439}
@ PROC_HIT_CRITICAL
Definition: SpellMgr.h:253
#define MELEE_BASED_TRIGGER_MASK
Definition: SpellMgr.h:182
@ PROC_EX_INTERNAL_CANT_PROC
Definition: SpellMgr.h:218
@ PROC_EX_INTERNAL_TRIGGERED
Definition: SpellMgr.h:221
@ PROC_FLAG_DONE_PERIODIC
Definition: SpellMgr.h:134
@ SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
Definition: SpellAuraDefines.h:288
@ SPELL_AURA_ADD_PCT_MODIFIER
Definition: SpellAuraDefines.h:171
@ SPELL_AURA_OBS_MOD_POWER
Definition: SpellAuraDefines.h:84
@ SPELL_AURA_ADD_FLAT_MODIFIER
Definition: SpellAuraDefines.h:170
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE
Definition: SpellAuraDefines.h:120
@ SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
Definition: SpellAuraDefines.h:135
@ SPELL_AURA_MOD_POWER_COST_SCHOOL
Definition: SpellAuraDefines.h:136
@ SPELL_AURA_MECHANIC_IMMUNITY
Definition: SpellAuraDefines.h:140
@ SPELL_AURA_RAID_PROC_FROM_CHARGE
Definition: SpellAuraDefines.h:286
@ SPELL_AURA_PROC_TRIGGER_DAMAGE
Definition: SpellAuraDefines.h:106
@ SPELL_AURA_REFLECT_SPELLS_SCHOOL
Definition: SpellAuraDefines.h:137
@ SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:128
static bool isNonTriggerAura[TOTAL_AURAS]
Definition: Unit.cpp:105
static bool isTriggerAura[TOTAL_AURAS]
Definition: Unit.cpp:103
std::list< ProcTriggeredData > ProcTriggeredList
Definition: Unit.cpp:15782
@ REACTIVE_OVERPOWER
Definition: Unit.h:590
@ REACTIVE_DEFENSE
Definition: Unit.h:588
@ REACTIVE_HUNTER_PARRY
Definition: Unit.h:589
@ REACTIVE_WOLVERINE_BITE
Definition: Unit.h:591
@ CONDITION_SOURCE_TYPE_SPELL_PROC
Definition: ConditionMgr.h:146
@ EFFECT_2
Definition: SharedDefines.h:33
@ SPELL_ATTR3_INSTANT_TARGET_PROCS
Definition: SharedDefines.h:512
#define EFFECT_ALL
Definition: SharedDefines.h:38
@ SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES
Definition: SharedDefines.h:609
void UpdateCombatSkills(Unit *victim, WeaponAttackType attType, bool defence, Item *item=nullptr)
Definition: PlayerUpdates.cpp:980
Definition: Unit.cpp:15763
Definition: Unit.h:420
void SetProcCooldown(uint32 cooldown)
Definition: Unit.h:454
Unit * GetActionTarget() const
Definition: Unit.h:440
Unit * GetProcTarget() const
Definition: Unit.h:441
bool HandleProcTriggerSpell(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, uint32 procPhase, ProcEventInfo &eventInfo)
Definition: Unit.cpp:8876
bool HandleAuraRaidProcFromChargeWithValue(AuraEffect *triggeredByAura)
Definition: Unit.cpp:17479
bool IsHunterPet() const
Definition: Unit.h:755
bool IsTriggeredAtSpellProcEvent(Unit *victim, Aura *aura, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *&spellProcEvent, ProcEventInfo const &eventInfo)
Definition: Unit.cpp:17340
bool HandleAuraProc(Unit *victim, uint32 damage, Aura *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool *handled)
Definition: Unit.cpp:8681
virtual bool HasSpellItemCooldown(uint32, uint32) const
Definition: Unit.h:1762
bool HandleDummyAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, ProcEventInfo const &eventInfo)
Definition: Unit.cpp:6540
void StartReactiveTimer(ReactiveType reactive)
Definition: Unit.h:1656
bool HandleOverrideClassScriptAuraProc(Unit *victim, uint32 damage, AuraEffect *triggeredByAura, SpellInfo const *procSpell, uint32 cooldown)
Definition: Unit.cpp:9803
bool HandleAuraRaidProcFromCharge(AuraEffect *triggeredByAura)
Definition: Unit.cpp:17568
bool IsCharmedOwnedByPlayerOrPlayer() const
Definition: Unit.h:1181
void HandleProcTriggerDamageAuraProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:7252
SpellModifier * GetSpellModifier() const
Definition: SpellAuraEffects.h:52
Unit * GetUnitOwner() const
Definition: SpellAuras.h:108

References AddComboPoints(), ASSERT, ProcTriggeredData::aura, AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, SpellInfo::CalcCastTime(), Aura::CallScriptAfterCheckProcHandlers(), Aura::CallScriptCheckProcHandlers(), CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_ROGUE, CLASS_WARRIOR, CONDITION_SOURCE_TYPE_SPELL_PROC, EFFECT_0, EFFECT_1, EFFECT_2, EFFECT_ALL, SpellInfo::Effects, ProcTriggeredData::effMask, FORM_GHOSTWOLF, ProcEventInfo::GetActionTarget(), ProcEventInfo::GetActor(), AuraEffect::GetAmount(), GetAppliedAuras(), AuraEffect::GetAuraType(), AuraEffect::GetBase(), AuraEffect::GetCasterGUID(), Aura::GetEffect(), Object::GetGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), ProcEventInfo::GetProcTarget(), GetShapeshiftForm(), AuraEffect::GetSpellInfo(), AuraEffect::GetSpellModifier(), Object::GetTypeId(), Aura::GetUnitOwner(), HandleAuraProc(), HandleAuraRaidProcFromCharge(), HandleAuraRaidProcFromChargeWithValue(), HandleDummyAuraProc(), HandleOverrideClassScriptAuraProc(), AuraEffect::HandleProcTriggerDamageAuraProc(), HandleProcTriggerSpell(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), HasSpellItemCooldown(), SpellInfo::Id, IsCharmedOwnedByPlayerOrPlayer(), IsClass(), IsHunterPet(), isNonTriggerAura, Object::IsPlayer(), isTriggerAura, IsTriggeredAtSpellProcEvent(), LOG_DEBUG, Spell::m_appliedMods, Spell::m_weaponItem, SpellInfo::ManaCost, SpellInfo::ManaCostPercentage, MAX_SPELL_EFFECTS, SpellInfo::Mechanic, MELEE_BASED_TRIGGER_MASK, ModifyAuraState(), PROC_EX_ABSORB, PROC_EX_BLOCK, PROC_EX_CRITICAL_HIT, PROC_EX_DODGE, PROC_EX_INTERNAL_CANT_PROC, PROC_EX_INTERNAL_TRIGGERED, PROC_EX_MISS, PROC_EX_NORMAL_HIT, PROC_EX_PARRY, PROC_EX_RESIST, PROC_FLAG_DONE_PERIODIC, PROC_HIT_CRITICAL, PROC_SPELL_PHASE_HIT, REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, REACTIVE_WOLVERINE_BITE, SpellInfo::SchoolMask, sConditionMgr, AuraEffect::SetAmount(), SetCantProc(), ProcEventInfo::SetProcCooldown(), SPELL_ATTR3_INSTANT_TARGET_PROCS, SPELL_ATTR4_REACTIVE_DAMAGE_PROC, SPELL_ATTR6_DO_NOT_CONSUME_RESOURCES, SPELL_AURA_ABILITY_IGNORE_AURASTATE, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_DUMMY, SPELL_AURA_MANA_SHIELD, SPELL_AURA_MECHANIC_IMMUNITY, SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_MECHANIC_RESISTANCE, SPELL_AURA_MOD_MELEE_HASTE, SPELL_AURA_MOD_POWER_COST_SCHOOL, SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_STUN, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PROC_TRIGGER_DAMAGE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_RAID_PROC_FROM_CHARGE, SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_AURA_SPELL_MAGNET, SPELL_AURA_TRANSFORM, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, ProcTriggeredData::spellProcEvent, StartReactiveTimer(), Object::ToPlayer(), Object::ToUnit(), ProcTriggeredData::triggerSpelId, TYPEID_PLAYER, and Player::UpdateCombatSkills().

Referenced by CalcAbsorbResist(), and ProcDamageAndSpell().

◆ processDummyAuras()

float Unit::processDummyAuras ( float  TakenTotalMod) const
private
11838{
11839 // note: old code coming from TC, just extracted here to remove the code duplication + solve potential crash
11840 // see: https://github.com/TrinityCore/TrinityCore/commit/c85710e148d75450baedf6632b9ca6fd40b4148e
11841
11842 // .. taken pct: dummy auras
11843 auto const& mDummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
11844 for (auto i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
11845 {
11846 if (!(*i) || !(*i)->GetSpellInfo())
11847 {
11848 continue;
11849 }
11850
11851 if (auto spellIconId = (*i)->GetSpellInfo()->SpellIconID)
11852 {
11853 switch (spellIconId)
11854 {
11855 // Cheat Death
11856 case 2109:
11857 if ((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
11858 {
11859 // Patch 2.4.3: The resilience required to reach the 90% damage reduction cap
11860 // is 22.5% critical strike damage reduction, or 444 resilience.
11861 // To calculate for 90%, we multiply the 100% by 4 (22.5% * 4 = 90%)
11862 float mod = -1.0f * GetMeleeCritDamageReduction(400);
11863 AddPct(TakenTotalMod, std::max(mod, float((*i)->GetAmount())));
11864 }
11865 break;
11866 }
11867 }
11868 }
11869 return TakenTotalMod;
11870}

References AddPct(), GetAuraEffectsByType(), GetMeleeCritDamageReduction(), SPELL_AURA_DUMMY, and SPELL_SCHOOL_MASK_NORMAL.

Referenced by MeleeDamageBonusTaken(), and SpellDamageBonusTaken().

◆ ProcessPositionDataChanged()

void Unit::ProcessPositionDataChanged ( PositionFullTerrainStatus const &  data)
overridevirtual

Reimplemented from WorldObject.

4220{
4223}
virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const &data)
Definition: Object.cpp:1163
virtual void ProcessTerrainStatusUpdate()
Definition: Unit.cpp:4225

References WorldObject::ProcessPositionDataChanged(), and ProcessTerrainStatusUpdate().

Referenced by Creature::Create().

◆ ProcessTerrainStatusUpdate()

void Unit::ProcessTerrainStatusUpdate ( )
virtual

Reimplemented in Player.

4226{
4227 if (GetTypeId() == TYPEID_UNIT)
4229
4230 if (IsFlying() || (!IsControlledByPlayer()))
4231 return;
4232
4233 LiquidData const& liquidData = GetLiquidData();
4234
4235 // remove appropriate auras if we are swimming/not swimming respectively
4236 if (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING)
4238 else if (!isSwimming())
4240
4241 // liquid aura handling
4242 LiquidTypeEntry const* curLiquid = nullptr;
4243 if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING))
4244 curLiquid = sLiquidTypeStore.LookupEntry(liquidData.Entry);
4245
4246 if (curLiquid != _lastLiquid)
4247 {
4250
4251 // Set _lastLiquid before casting liquid spell to avoid infinite loops
4252 _lastLiquid = curLiquid;
4253
4255 if (curLiquid && curLiquid->SpellId && (!player || !player->IsGameMaster()))
4256 CastSpell(this, curLiquid->SpellId, true);
4257 }
4258}
DBCStorage< LiquidTypeEntry > sLiquidTypeStore(LiquidTypefmt)
@ AURA_INTERRUPT_FLAG_NOT_ABOVEWATER
Definition: SpellDefines.h:51
@ AURA_INTERRUPT_FLAG_NOT_UNDERWATER
Definition: SpellDefines.h:52
void UpdateMovementFlags()
Definition: Creature.cpp:3414
bool isSwimming() const
Definition: Unit.h:1726
bool IsFlying() const
Definition: Unit.h:1728
Definition: Map.h:171
uint32 Entry
Definition: Map.h:174
Definition: DBCStructure.h:1283
uint32 SpellId
Definition: DBCStructure.h:1289

References _lastLiquid, AURA_INTERRUPT_FLAG_NOT_ABOVEWATER, AURA_INTERRUPT_FLAG_NOT_UNDERWATER, CastSpell(), LiquidData::Entry, GetCharmerOrOwnerPlayerOrPlayerItself(), WorldObject::GetLiquidData(), Object::GetTypeId(), IsControlledByPlayer(), IsFlying(), Player::IsGameMaster(), isSwimming(), MAP_LIQUID_STATUS_SWIMMING, RemoveAurasDueToSpell(), RemoveAurasWithInterruptFlags(), sLiquidTypeStore, LiquidTypeEntry::SpellId, LiquidData::Status, Object::ToCreature(), TYPEID_UNIT, and Creature::UpdateMovementFlags().

Referenced by ProcessPositionDataChanged(), and Player::ProcessTerrainStatusUpdate().

◆ ProhibitSpellSchool()

virtual void Unit::ProhibitSpellSchool ( SpellSchoolMask  ,
uint32   
)
inlinevirtual

Reimplemented in Creature, and Player.

1391{ }

Referenced by Spell::EffectInterruptCast().

◆ propagateSpeedChange()

void Unit::propagateSpeedChange ( )
inline

-------—End of Pet responses methods-------—

void propagateSpeedChange()
Definition: MotionMaster.cpp:887

References GetMotionMaster(), and MotionMaster::propagateSpeedChange().

Referenced by SetSpeed(), and SetWalk().

◆ RecalculateObjectScale()

void Unit::RecalculateObjectScale ( )
virtual
16683{
16685 float scale = GetNativeObjectScale() + CalculatePct(1.0f, scaleAuras);
16686 float scaleMin = IsPlayer() ? 0.1f : 0.01f;
16687 SetObjectScale(std::max(scale, scaleMin));
16688}
@ SPELL_AURA_MOD_SCALE_2
Definition: SpellAuraDefines.h:302
@ SPELL_AURA_MOD_SCALE
Definition: SpellAuraDefines.h:124
virtual void SetObjectScale(float scale)
Definition: Object.h:116
virtual float GetNativeObjectScale() const
Definition: Unit.h:1509

References CalculatePct(), GetNativeObjectScale(), GetTotalAuraModifier(), Object::IsPlayer(), Object::SetObjectScale(), SPELL_AURA_MOD_SCALE, and SPELL_AURA_MOD_SCALE_2.

Referenced by AuraEffect::HandleAuraModScale().

◆ RemoveAllAttackers()

void Unit::RemoveAllAttackers ( )

Remove all units in m_attackers list and send them AttackStop()

10425{
10426 while (!m_attackers.empty())
10427 {
10428 AttackerSet::iterator iter = m_attackers.begin();
10429 if (!(*iter)->AttackStop())
10430 {
10431 LOG_ERROR("entities.unit", "WORLD: Unit has an attacker that isn't attacking it!");
10432 m_attackers.erase(iter);
10433 }
10434 }
10435}

References LOG_ERROR, and m_attackers.

Referenced by CombatStop(), Spell::EffectSanctuary(), AuraEffect::HandleFeignDeath(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), spell_halion_twilight_phasing_aura::OnApply(), spell_halion_twilight_phasing_aura::OnRemove(), and npc_qiraj_war_spawn::npc_qiraj_war_spawnAI::UpdateAI().

◆ RemoveAllAuras()

void Unit::RemoveAllAuras ( )
5271{
5272 // this may be a dead loop if some events on aura remove will continiously apply aura on remove
5273 // we want to have all auras removed, so use your brain when linking events
5274 while (!m_appliedAuras.empty() || !m_ownedAuras.empty())
5275 {
5276 AuraApplicationMap::iterator aurAppIter;
5277 for (aurAppIter = m_appliedAuras.begin(); aurAppIter != m_appliedAuras.end();)
5279
5280 AuraMap::iterator aurIter;
5281 for (aurIter = m_ownedAuras.begin(); aurIter != m_ownedAuras.end();)
5282 RemoveOwnedAura(aurIter);
5283 }
5284}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by CleanupBeforeRemoveFromMap(), npc_mograine::npc_mograineAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), boss_headless_horseman_head::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), boss_taldaram::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), boss_leotheras_the_blind::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_anubarak_spike::npc_anubarak_spikeAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), boss_razorgore::boss_razorgoreAI::DoChangePhase(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_mimiron::boss_mimironAI::EnterEvadeMode(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::EnterEvadeMode(), npc_ulduar_vx001::npc_ulduar_vx001AI::EnterEvadeMode(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::EnterEvadeMode(), GuardAI::EnterEvadeMode(), boss_doomrel::boss_doomrelAI::EnterEvadeMode(), FollowerAI::EnterEvadeMode(), LichKingDeathEvent::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), spell_herald_volzaj_insanity::HandleDummyEffect(), misc_commandscript::HandleUnAuraCommand(), boss_ick::boss_ickAI::JustDied(), boss_venoxis::JustDied(), boss_taldaram::JustEngagedWith(), boss_mimiron::boss_mimironAI::JustEngagedWith(), boss_high_botanist_freywinn::JustEngagedWith(), boss_novos::boss_novosAI::JustEngagedWith(), boss_professor_putricide::boss_professor_putricideAI::JustEngagedWith(), boss_commander_stoutbeard::boss_commander_stoutbeardAI::JustEngagedWith(), boss_high_astromancer_solarian::JustEngagedWith(), boss_steelbreaker::boss_steelbreakerAI::JustReachedHome(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::JustReachedHome(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::JustReachedHome(), boss_urom::boss_uromAI::LeaveCombat(), boss_taldaram::MovementInform(), npc_hallows_end_soh::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), spell_kaelthas_flame_strike::OnRemove(), PretendToDie(), boss_alar::PretendToDie(), Creature::RemoveCorpse(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), boss_venoxis::Reset(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_bjarngrim::boss_bjarngrimAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_hodir::boss_hodirAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_skadi::boss_skadiAI::Reset(), boss_skadi_grauf::boss_skadi_graufAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), Pet::SavePetToDB(), npc_anubarak_spike::npc_anubarak_spikeAI::SelectNewTarget(), npc_harrison_jones::npc_harrison_jonesAI::SpellHit(), npc_frost_sphere::npc_frost_sphereAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_soh_fire_trigger::SpellHit(), npc_hallows_end_train_fire::SpellHit(), boss_headless_horseman_head::SpellHit(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_lk_spirit_bomb::npc_lk_spirit_bombAI::UpdateAI(), npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_magus_telestra::boss_magus_telestraAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_iron_watcher::npc_iron_watcherAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), and npc_aeranas::npc_aeranasAI::UpdateAI().

◆ RemoveAllAurasExceptType()

void Unit::RemoveAllAurasExceptType ( AuraType  type)
5345{
5346 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5347 {
5348 Aura const* aura = iter->second->GetBase();
5349 if (aura->GetSpellInfo()->HasAura(type))
5350 ++iter;
5351 else
5353 }
5354
5355 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5356 {
5357 Aura* aura = iter->second;
5358 if (aura->GetSpellInfo()->HasAura(type))
5359 ++iter;
5360 else
5362 }
5363}

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), SpellInfo::HasAura(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), and npc_iron_watcher::npc_iron_watcherAI::SpellHit().

◆ RemoveAllAurasOnDeath()

void Unit::RemoveAllAurasOnDeath ( )
5301{
5302 // used just after dieing to remove all visible auras
5303 // and disable the mods for the passive ones
5304 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5305 {
5306 Aura const* aura = iter->second->GetBase();
5309 else
5310 ++iter;
5311 }
5312
5313 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5314 {
5315 Aura* aura = iter->second;
5318 else
5319 ++iter;
5320 }
5321}
@ AURA_REMOVE_BY_DEATH
Definition: SpellAuraDefines.h:396
@ SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD
Definition: SharedDefines.h:643
bool IsDeathPersistent() const
Definition: SpellAuras.cpp:1087

References _UnapplyAura(), AURA_REMOVE_BY_DEATH, Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsDeathPersistent(), Aura::IsPassive(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), and SPELL_ATTR7_DISABLE_AURA_WHILE_DEAD.

Referenced by spell_dk_death_pact::FilterTargets(), Kill(), Player::LoadFromDB(), and setDeathState().

◆ RemoveAllAurasRequiringDeadTarget()

void Unit::RemoveAllAurasRequiringDeadTarget ( )
5324{
5325 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5326 {
5327 Aura const* aura = iter->second->GetBase();
5328 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5330 else
5331 ++iter;
5332 }
5333
5334 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5335 {
5336 Aura* aura = iter->second;
5337 if (!aura->IsPassive() && aura->GetSpellInfo()->IsRequiringDeadTarget())
5339 else
5340 ++iter;
5341 }
5342}
bool IsRequiringDeadTarget() const
Definition: SpellInfo.cpp:1221

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, Aura::GetSpellInfo(), Aura::IsPassive(), SpellInfo::IsRequiringDeadTarget(), m_appliedAuras, m_ownedAuras, and RemoveOwnedAura().

Referenced by Player::LoadFromDB().

◆ RemoveAllControlled()

void Unit::RemoveAllControlled ( bool  onDeath = false)
11022{
11023 // possessed pet and vehicle
11024 if (IsPlayer())
11026
11027 while (!m_Controlled.empty())
11028 {
11029 Unit* target = *m_Controlled.begin();
11030 m_Controlled.erase(m_Controlled.begin());
11031 if (target->GetCharmerGUID() == GetGUID())
11032 {
11033 target->RemoveCharmAuras();
11034 }
11035 else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon())
11036 {
11037 if (!(onDeath && !IsPlayer() && target->IsGuardian()))
11038 {
11039 target->ToTempSummon()->UnSummon();
11040 }
11041 }
11042 else
11043 {
11044 LOG_ERROR("entities.unit", "Unit {} is trying to release unit {} which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
11045 }
11046 }
11047}
void StopCastingCharm(Aura *except=nullptr)
Definition: Player.cpp:9250
bool IsGuardian() const
Definition: Unit.h:752
void RemoveCharmAuras()
Definition: Unit.cpp:11132

References GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwnerGUID(), IsGuardian(), Object::IsPlayer(), IsSummon(), LOG_ERROR, m_Controlled, RemoveCharmAuras(), Player::StopCastingCharm(), Object::ToPlayer(), ToTempSummon(), and TempSummon::UnSummon().

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ RemoveAllDynObjects()

void Unit::RemoveAllDynObjects ( )
6115{
6116 while (!m_dynObj.empty())
6117 m_dynObj.front()->Remove();
6118}

References m_dynObj.

Referenced by RemoveFromWorld(), Player::TeleportTo(), and npc_icc_putricades_trap::npc_icc_putricades_trapAI::UpdateAI().

◆ RemoveAllGameObjects()

void Unit::RemoveAllGameObjects ( )
6215{
6216 while(!m_gameObj.empty())
6217 {
6218 GameObject* go = ObjectAccessor::GetGameObject(*this, *m_gameObj.begin());
6219 if(go)
6220 {
6222 go->SetRespawnTime(0);
6223 go->Delete();
6224 }
6225 m_gameObj.erase(m_gameObj.begin());
6226 }
6227}
void Delete()
Definition: GameObject.cpp:979
void SetRespawnTime(int32 respawn)
Definition: GameObject.cpp:1303

References GameObject::Delete(), ObjectGuid::Empty, ObjectAccessor::GetGameObject(), m_gameObj, GameObject::SetOwnerGUID(), and GameObject::SetRespawnTime().

Referenced by CleanupBeforeRemoveFromMap(), npc_ice_tomb::npc_ice_tombAI::JustDied(), RemoveFromWorld(), npc_brewfest_super_brew_trigger::UpdateAI(), and boss_sapphiron::boss_sapphironAI::UpdateAI().

◆ RemoveAllMinionsByEntry()

void Unit::RemoveAllMinionsByEntry ( uint32  entry)
10799{
10800 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
10801 {
10802 Unit* unit = *itr;
10803 ++itr;
10804 if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
10805 && unit->ToCreature()->IsSummon()) // minion, actually
10806 unit->ToTempSummon()->UnSummon();
10807 // i think this is safe because i have never heard that a despawned minion will trigger a same minion
10808 }
10809}

References Object::GetEntry(), Object::GetTypeId(), IsSummon(), m_Controlled, Object::ToCreature(), ToTempSummon(), TYPEID_UNIT, and TempSummon::UnSummon().

Referenced by Player::ApplyEquipSpell(), Spell::EffectSummonType(), npc_nelson::npc_nelsonAI::Reset(), SetMinion(), and npc_nelson::npc_nelsonAI::UpdateAI().

◆ RemoveAppliedAuras() [1/2]

void Unit::RemoveAppliedAuras ( std::function< bool(AuraApplication const *)> const &  check)
4833{
4834 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
4835 {
4836 if (check(iter->second))
4837 {
4838 RemoveAura(iter);
4839 continue;
4840 }
4841 ++iter;
4842 }
4843}

References m_appliedAuras, and RemoveAura().

Referenced by RemoveArenaAuras().

◆ RemoveAppliedAuras() [2/2]

void Unit::RemoveAppliedAuras ( uint32  spellId,
std::function< bool(AuraApplication const *)> const &  check 
)
4859{
4860 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4861 {
4862 if (check(iter->second))
4863 {
4864 RemoveAura(iter);
4865 continue;
4866 }
4867 ++iter;
4868 }
4869}

References m_appliedAuras, and RemoveAura().

◆ RemoveAreaAurasDueToLeaveWorld()

void Unit::RemoveAreaAurasDueToLeaveWorld ( )
5238{
5239 // make sure that all area auras not applied on self are removed - prevent access to deleted pointer later
5240 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5241 {
5242 Aura* aura = iter->second;
5243 ++iter;
5244 Aura::ApplicationMap const& appMap = aura->GetApplicationMap();
5245 for (Aura::ApplicationMap::const_iterator itr = appMap.begin(); itr != appMap.end();)
5246 {
5247 AuraApplication* aurApp = itr->second;
5248 ++itr;
5249 Unit* target = aurApp->GetTarget();
5250 if (target == this)
5251 continue;
5252 target->RemoveAura(aurApp);
5253 // things linked on aura remove may apply new area aura - so start from the beginning
5254 iter = m_ownedAuras.begin();
5255 }
5256 }
5257
5258 // remove area auras owned by others
5259 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5260 {
5261 if (iter->second->GetBase()->GetOwner() != this)
5262 {
5263 RemoveAura(iter);
5264 }
5265 else
5266 ++iter;
5267 }
5268}
ApplicationMap const & GetApplicationMap()
Definition: SpellAuras.h:181
std::map< ObjectGuid, AuraApplication * > ApplicationMap
Definition: SpellAuras.h:90

References Aura::GetApplicationMap(), AuraApplication::GetTarget(), m_appliedAuras, m_ownedAuras, and RemoveAura().

Referenced by RemoveFromWorld().

◆ RemoveArenaAuras()

void Unit::RemoveArenaAuras ( )
5287{
5288 // in join, remove positive buffs, on end, remove negative
5289 // used to remove positive visible auras in arenas
5290 RemoveAppliedAuras([](AuraApplication const* aurApp)
5291 {
5292 Aura const* aura = aurApp->GetBase();
5293 return (!aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_ALLOW_ENETRING_ARENA) // don't remove stances, shadowform, pally/hunter auras
5294 && !aura->IsPassive() // don't remove passive auras
5295 && (aurApp->IsPositive() || !aura->GetSpellInfo()->HasAttribute(SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD))) || // not negative death persistent auras
5296 aura->GetSpellInfo()->HasAttribute(SPELL_ATTR5_REMOVE_ENTERING_ARENA); // special marker, always remove
5297 });
5298}
@ SPELL_ATTR5_REMOVE_ENTERING_ARENA
Definition: SharedDefines.h:569
@ SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD
Definition: SharedDefines.h:513
@ SPELL_ATTR4_ALLOW_ENETRING_ARENA
Definition: SharedDefines.h:551
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check)
Definition: Unit.cpp:4832
bool IsPositive() const
Definition: SpellAuras.h:68

References AuraApplication::GetBase(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), Aura::IsPassive(), AuraApplication::IsPositive(), RemoveAppliedAuras(), SPELL_ATTR3_ALLOW_AURA_WHILE_DEAD, SPELL_ATTR4_ALLOW_ENETRING_ARENA, and SPELL_ATTR5_REMOVE_ENTERING_ARENA.

Referenced by Player::TeleportTo().

◆ RemoveAura() [1/4]

void Unit::RemoveAura ( Aura aur,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4812{
4813 if (aura->IsRemoved())
4814 return;
4815 if (AuraApplication* aurApp = aura->GetApplicationOfTarget(GetGUID()))
4816 RemoveAura(aurApp, mode);
4817}

References Aura::GetApplicationOfTarget(), Object::GetGUID(), Aura::IsRemoved(), and RemoveAura().

◆ RemoveAura() [2/4]

void Unit::RemoveAura ( AuraApplication aurApp,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4769{
4770 // we've special situation here, RemoveAura called while during aura removal
4771 // this kind of call is needed only when aura effect removal handler
4772 // or event triggered by it expects to remove
4773 // not yet removed effects of an aura
4774 if (aurApp->GetRemoveMode())
4775 {
4776 // remove remaining effects of an aura
4777 for (uint8 itr = 0; itr < MAX_SPELL_EFFECTS; ++itr)
4778 {
4779 if (aurApp->HasEffect(itr))
4780 aurApp->_HandleEffect(itr, false);
4781 }
4782 return;
4783 }
4784 // no need to remove
4785 if (aurApp->GetBase()->GetApplicationOfTarget(GetGUID()) != aurApp || aurApp->GetBase()->IsRemoved())
4786 return;
4787
4788 uint32 spellId = aurApp->GetBase()->GetId();
4789 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4790
4791 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4792 {
4793 if (aurApp == iter->second)
4794 {
4795 // Prevent Arena Preparation aura from being removed by player actions
4796 // It's an invisibility spell so any interaction/spell cast etc. removes it.
4797 // Should only be removed by the arena script, once the match starts.
4799 {
4800 return;
4801 }
4802
4803 RemoveAura(iter, mode);
4804 return;
4805 }
4806 else
4807 ++iter;
4808 }
4809}
@ SPELL_AURA_ARENA_PREPARATION
Definition: SpellAuraDefines.h:278

References AuraApplication::_HandleEffect(), Aura::GetApplicationOfTarget(), AuraApplication::GetBase(), Object::GetGUID(), Aura::GetId(), AuraApplication::GetRemoveMode(), AuraApplication::HasEffect(), Aura::HasEffectType(), Aura::IsRemoved(), m_appliedAuras, MAX_SPELL_EFFECTS, RemoveAura(), and SPELL_AURA_ARENA_PREPARATION.

◆ RemoveAura() [3/4]

void Unit::RemoveAura ( AuraApplicationMap::iterator &  i,
AuraRemoveMode  mode = AURA_REMOVE_BY_DEFAULT 
)
4739{
4740 AuraApplication* aurApp = i->second;
4741 // Do not remove aura which is already being removed
4742 if (aurApp->GetRemoveMode())
4743 return;
4744 Aura* aura = aurApp->GetBase();
4745 _UnapplyAura(i, mode);
4746 // Remove aura - for Area and Target auras
4747 if (aura->GetOwner() == this)
4748 aura->Remove(mode);
4749}

References _UnapplyAura(), AuraApplication::GetBase(), Aura::GetOwner(), AuraApplication::GetRemoveMode(), and Aura::Remove().

Referenced by _RemoveNoStackAurasDueToAura(), boss_marli::_schedulePhaseTroll(), ApplySpellDispelImmunity(), Player::CheckAreaExploreAndOutdoor(), boss_gyth::boss_gythAI::DamageTaken(), boss_headless_horseman::DamageTaken(), npc_power_spark::npc_power_sparkAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_hor_lich_king::npc_hor_lich_kingAI::DoAction(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_pilgrims_bounty_chair::DoAction(), boss_paletress::boss_paletressAI::DoAction(), boss_vezax::boss_vezaxAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_yoggsaron_crusher_tentacle::boss_yoggsaron_crusher_tentacleAI::DoAction(), boss_yoggsaron_corruptor_tentacle::boss_yoggsaron_corruptor_tentacleAI::DoAction(), boss_yoggsaron_constrictor_tentacle::boss_yoggsaron_constrictor_tentacleAI::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), Player::DuelComplete(), Spell::EffectDispelMechanic(), Spell::EffectForceCast(), Spell::EffectHeal(), Spell::EffectSummonPet(), Spell::EffectTriggerSpell(), npc_thrall_bfu::npc_thrall_bfuAI::EnterEvadeMode(), GetDiseasesByCaster(), AuraEffect::HandleAuraLinked(), AuraEffect::HandleAuraModSchoolImmunity(), Aura::HandleAuraSpecificMods(), deserter_commandscript::HandleDeserterRemove(), deserter_commandscript::HandleDeserterRemoveAll(), spell_q12096_q12092_bark::HandleDummy(), HandleDummyAuraProc(), spell_valanar_kinetic_bomb_aura::HandleDummyTick(), spell_warl_demonic_circle_summon::HandleDummyTick(), spell_midsummer_ribbon_pole::HandleEffectPeriodic(), spell_dk_improved_blood_presence::HandleEffectRemove(), spell_dk_improved_frost_presence::HandleEffectRemove(), spell_dk_improved_unholy_presence::HandleEffectRemove(), spell_dk_presence::HandleEffectRemove(), spell_pal_blessing_of_sanctuary::HandleEffectRemove(), spell_sha_chain_heal::HandleHeal(), spell_sindragosa_frost_breath::HandleInfusion(), spell_warl_demonic_circle_summon::HandleRemove(), spell_putricide_eat_ooze::HandleScript(), AuraEffect::HandleShapeshiftBoosts(), npc_zulian_prowler::npc_zulian_prowlerAI::JustEngagedWith(), boss_jaraxxus::boss_jaraxxusAI::JustEngagedWith(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::JustEngagedWith(), npc_ulduar_snow_mound::MoveInLineOfSight(), spell_blood_queen_vampiric_bite::OnCast(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), npc_essence_of_twin::OnGossipHello(), spell_love_is_in_the_air_romantic_picnic::OnPeriodic(), spell_yogg_saron_empowered_aura::OnPeriodic(), npc_thrall_bfu::OnQuestReward(), npc_vortex_ride::npc_vortex_rideAI::PassengerBoarded(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::PassengerBoarded(), npc_eastvale_peasent::PathEndReached(), BattlefieldWG::PromotePlayer(), RemoveAppliedAuras(), RemoveAreaAurasDueToLeaveWorld(), RemoveAura(), RemoveAurasByShapeShift(), RemoveAurasByType(), RemoveAurasDueToItemSpell(), RemoveAurasDueToSpell(), RemoveAurasWithAttribute(), RemoveAurasWithFamily(), RemoveAurasWithInterruptFlags(), RemoveAurasWithMechanic(), RemoveMovementImpairingAuras(), BattlegroundIC::RemovePlayer(), BattlegroundMap::RemovePlayerFromMap(), boss_bjarngrim::boss_bjarngrimAI::RemoveStanceAura(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_marli::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_varos::boss_varosAI::Reset(), NPCStaveQuestAI::ResetState(), boss_anomalus::boss_anomalusAI::SetData(), boss_hodir::boss_hodirAI::SmallIcicles(), boss_malygos::boss_malygosAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_nelson::npc_nelsonAI::SpellHit(), boss_headless_horseman::SpellHit(), boss_viscidus::SpellHit(), spell_pal_hand_of_sacrifice_aura::Split(), boss_sartharion_shadron::boss_sartharion_shadronAI::SummonedCreatureDies(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), boss_headless_horseman::UpdateAI(), npc_onyxian_lair_guard::UpdateAI(), boss_viscidus::UpdateAI(), boss_taldaram::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_freya::boss_freyaAI::UpdateAI(), boss_freya_elder_brightleaf::boss_freya_elder_brightleafAI::UpdateAI(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), Spell::UpdateChanneledTargetList(), and boss_bjarngrim::boss_bjarngrimAI::WaypointReached().

◆ RemoveAura() [4/4]

void Unit::RemoveAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4752{
4753 AuraApplicationMapBoundsNonConst range = m_appliedAuras.equal_range(spellId);
4754 for (AuraApplicationMap::iterator iter = range.first; iter != range.second;)
4755 {
4756 Aura const* aura = iter->second->GetBase();
4757 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4758 && (!caster || aura->GetCasterGUID() == caster))
4759 {
4760 RemoveAura(iter, removeMode);
4761 return;
4762 }
4763 else
4764 ++iter;
4765 }
4766}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

◆ RemoveAuraFromStack()

void Unit::RemoveAuraFromStack ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4888{
4889 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4890 for (AuraMap::iterator iter = range.first; iter != range.second;)
4891 {
4892 Aura* aura = iter->second;
4893 if ((aura->GetType() == UNIT_AURA_TYPE)
4894 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4895 {
4896 aura->ModStackAmount(-1, removeMode);
4897 return;
4898 }
4899 else
4900 ++iter;
4901 }
4902}
@ UNIT_AURA_TYPE
Definition: SpellAuraDefines.h:385
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool periodicReset=false)
Definition: SpellAuras.cpp:1021
AuraObjectType GetType() const
Definition: SpellAuras.cpp:481

References Aura::GetCasterGUID(), Aura::GetType(), m_ownedAuras, Aura::ModStackAmount(), and UNIT_AURA_TYPE.

Referenced by Spell::EffectSchoolDMG(), HandleAuraProc(), HandleDummyAuraProc(), spell_putricide_gaseous_bloat_aura::HandleExtraEffect(), spell_oculus_evasive_maneuvers_aura::HandleProc(), spell_dk_scent_of_blood::HandleProc(), spell_item_brittle_armor::HandleScript(), spell_item_mercurial_shield::HandleScript(), boss_viscidus::SpellHit(), and boss_selin_fireheart::UpdateAI().

◆ RemoveAurasByShapeShift()

void Unit::RemoveAurasByShapeShift ( )
5222{
5223 uint32 mechanic_mask = (1 << MECHANIC_SNARE) | (1 << MECHANIC_ROOT);
5224 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5225 {
5226 Aura const* aura = iter->second->GetBase();
5227 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask) &&
5229 {
5230 RemoveAura(iter);
5231 continue;
5232 }
5233 ++iter;
5234 }
5235}
@ SPELL_ATTR0_CU_AURA_CC
Definition: SpellInfo.h:181
uint32 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:1991

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), m_appliedAuras, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), SPELL_ATTR0_CU_AURA_CC, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by AuraEffect::HandleAuraModShapeshift().

◆ RemoveAurasByType()

void Unit::RemoveAurasByType ( AuraType  auraType,
ObjectGuid  casterGUID = ObjectGuid::Empty,
Aura except = nullptr,
bool  negative = true,
bool  positive = true 
)
5062{
5063 // simple check if list is empty
5064 if (m_modAuras[auraType].empty())
5065 return;
5066
5067 for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
5068 {
5069 Aura* aura = (*iter)->GetBase();
5071
5072 ++iter;
5073 if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID)
5074 && ((negative && !aurApp->IsPositive()) || (positive && aurApp->IsPositive())))
5075 {
5076 uint32 removedAuras = m_removedAurasCount;
5077 RemoveAura(aurApp);
5078 if (m_removedAurasCount > removedAuras + 1)
5079 iter = m_modAuras[auraType].begin();
5080 }
5081 }
5082}

References Aura::GetApplicationOfTarget(), Aura::GetCasterGUID(), Object::GetGUID(), AuraApplication::IsPositive(), m_modAuras, m_removedAurasCount, and RemoveAura().

Referenced by _EnterVehicle(), Spell::_handle_finish_phase(), Player::ActivateTaxiPathTo(), Battleground::AddPlayer(), Attack(), spell_gen_summon_tournament_mount::CheckIfLanceEquipped(), ClearComboPoints(), Player::ContinueTaxiFlight(), boss_kologarn_arms::boss_kologarn_armsAI::DamageTaken(), Spell::DoSpellHitOnUnit(), Spell::EffectPowerBurn(), Spell::EffectTriggerSpell(), BattlegroundWS::EventPlayerClickedOnFlag(), ExitVehicle(), WorldSession::HandleAuctionHelloOpcode(), WorldSession::HandleAuctionListBidderItems(), WorldSession::HandleAuctionListItems(), WorldSession::HandleAuctionListOwnerItemsEvent(), WorldSession::HandleAuctionPlaceBid(), WorldSession::HandleAuctionRemoveItem(), WorldSession::HandleAuctionSellItem(), spell_warl_seduction::HandleAuraApply(), AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraModStateImmunity(), AuraEffect::HandleAuraMounted(), AuraEffect::HandleAuraTransform(), WorldSession::HandleBankerActivateOpcode(), WorldSession::HandleBinderActivateOpcode(), WorldSession::HandleBuybackItem(), WorldSession::HandleBuyStableSlot(), WorldSession::HandleCancelMountAuraOpcode(), misc_commandscript::HandleDismountCommand(), spell_item_reindeer_transformation::HandleDummy(), spell_item_brewfest_mount_transformation::HandleDummy(), HandleDummyAuraProc(), spell_rog_vanish::HandleEffect(), spell_hydross_mark_of_hydross::HandleEffectApply(), WorldSession::HandleGossipSelectOptionOpcode(), WorldSession::HandleListStabledPetsOpcode(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), WorldSession::HandleMoveWorldportAck(), spell_oculus_rider_aura::HandleOnEffectApply(), spell_algalon_remove_phase_aura::HandlePeriodic(), WorldSession::HandlePetitionBuyOpcode(), WorldSession::HandleQuestgiverHelloOpcode(), WorldSession::HandleRepairItemOpcode(), WorldSession::HandleSaveGuildEmblemOpcode(), spell_gen_mine_sweeper::HandleSchoolDMG(), WorldSession::HandleSellItemOpcode(), WorldSession::HandleSpiritHealerActivateOpcode(), WorldSession::HandleStablePet(), WorldSession::HandleStableSwapPet(), WorldSession::HandleTabardVendorActivateOpcode(), WorldSession::HandleTalentWipeConfirmOpcode(), WorldSession::HandleTaxiQueryAvailableNodes(), WorldSession::HandleTrainerBuySpellOpcode(), WorldSession::HandleUnstablePet(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::JustEngagedWith(), Player::LeaveBattleground(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), spell_gen_aura_service_uniform::OnApply(), Player::ProcessDelayedOperations(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), Vehicle::RemoveAllPassengers(), RemoveBindSightAuras(), RemoveCharmAuras(), Battleground::RemovePlayerAtLeave(), WorldSession::SendDoFlight(), WorldSession::SendListInventory(), Player::SendLoot(), WorldSession::SendTrainerList(), SetCharmedBy(), Player::StopCastingCharm(), Player::TeleportTo(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), GameObject::Use(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ RemoveAurasDueToItemSpell()

void Unit::RemoveAurasDueToItemSpell ( uint32  spellId,
ObjectGuid  castItemGuid 
)
5048{
5049 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
5050 {
5051 if (iter->second->GetBase()->GetCastItemGUID() == castItemGuid)
5052 {
5053 RemoveAura(iter);
5054 iter = m_appliedAuras.lower_bound(spellId);
5055 }
5056 else
5057 ++iter;
5058 }
5059}

References m_appliedAuras, and RemoveAura().

Referenced by Player::ApplyEnchantment(), and Player::ApplyEquipSpell().

◆ RemoveAurasDueToSpell()

void Unit::RemoveAurasDueToSpell ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4872{
4873 for (AuraApplicationMap::iterator iter = m_appliedAuras.lower_bound(spellId); iter != m_appliedAuras.upper_bound(spellId);)
4874 {
4875 Aura const* aura = iter->second->GetBase();
4876 if (((aura->GetEffectMask() & reqEffMask) == reqEffMask)
4877 && (!casterGUID || aura->GetCasterGUID() == casterGUID))
4878 {
4879 RemoveAura(iter, removeMode);
4880 iter = m_appliedAuras.lower_bound(spellId);
4881 }
4882 else
4883 ++iter;
4884 }
4885}

References Aura::GetCasterGUID(), Aura::GetEffectMask(), m_appliedAuras, and RemoveAura().

Referenced by Spell::_cast(), Player::_removeTalentAurasAndSpells(), Player::ActivateSpec(), Vehicle::AddPassenger(), spell_commander_sarannis_arcane_devastation::AfterApply(), spell_dru_feral_swiftness::AfterRemove(), spell_dru_barkskin::AfterRemove(), spell_dru_savage_roar_aura::AfterRemove(), spell_dru_survival_instincts_aura::AfterRemove(), Player::ApplyEquipSpell(), boss_hakkar::boss_hakkarAI::ApplyHakkarPowerStacks(), boss_buru::ChaseNewVictim(), spell_eredar_twins_handle_touch::CheckCast(), boss_volazj::CheckPhaseMinions(), spell_botanica_shift_form_aura::CheckProc(), spell_mage_burning_determination::CheckProc(), boss_isle_of_conquest::boss_isle_of_conquestAI::CheckRageBuff(), Player::CleanupAfterTaxiFlight(), AuraEffect::CleanupTriggeredSpells(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), spell_ruby_sanctum_rallying_shout::CountAllies(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_buru::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_leotheras_the_blind::DemonTime(), Player::DestroyItem(), npc_drakonid_spawner::DoAction(), npc_twilight_volunteer::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_frozen_core::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_ambassador_hellmaw::DoAction(), boss_illidan_stormrage::boss_illidan_stormrageAI::DoAction(), npc_pet_gen_argent_pony_bridle::DoAction(), InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), Spell::DoTriggersOnSpellHit(), Spell::EffectApplyGlyph(), Spell::EffectHeal(), Spell::EffectRemoveAura(), Spell::EffectSchoolDMG(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_halazzi::EnterPhase(), boss_zuljin::boss_zuljinAI::EnterPhase(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerDroppedFlag(), BattlegroundWS::EventPlayerDroppedFlag(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), BattleExperienceEvent::Execute(), SendEncounterUnit::Execute(), FrostBombExplosion::Execute(), AuraRemoveEvent::Execute(), spell_sindragosa_ice_tomb_trap_aura::ExtraRemoveEffect(), spell_warr_improved_spell_reflection_trigger::FilterTargets(), lfg::LFGMgr::FinishDungeon(), spell_dru_berserk::HandleAfterCast(), spell_capacitus_polarity_charge_aura::HandleAfterRemove(), BattlegroundDS::HandleAreaTrigger(), OutdoorPvPSI::HandleAreaTrigger(), AuraEffect::HandleAuraControlVehicle(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModShapeshift(), Aura::HandleAuraSpecificMods(), boss_janalai::boss_janalaiAI::HandleBombSequence(), spell_moroes_vanish::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_q13007_iron_colossus::HandleDummy(), spell_ahn_kahet_swarmer_aura::HandleDummy(), spell_halion_twilight_division::HandleDummy(), spell_putricide_ooze_eruption_searcher::HandleDummy(), spell_warhead_detonate::HandleDummy(), spell_dru_starfall_dummy::HandleDummy(), HandleDummyAuraProc(), spell_magtheridon_shadow_grasp_visual::HandleDummyRemove(), spell_shadowfang_keep_forsaken_skills::spell_shadowfang_keep_forsaken_skills_AuraScript::HandleDummyTick(), spell_oculus_soar_aura::HandleEffectPeriodic(), spell_q12730_quenching_mist::HandleEffectPeriodic(), spell_rog_prey_on_the_weak::HandleEffectPeriodic(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_reliquary_of_souls_aura_of_suffering_aura::HandleEffectRemove(), spell_serpentshrine_cavern_coilfang_water::HandleEffectRemove(), spell_q10769_dissension_amongst_the_ranks_aura::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), spell_midsummer_fling_torch::HandleFinish(), gm_commandscript::HandleGMVisibleCommand(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), spell_transitus_shield_beam_aura::HandleOnEffectRemove(), OPvPCapturePointZM_GraveYard::HandleOpenGo(), spell_hadronox_summon_periodic_aura::HandlePeriodic(), spell_algalon_phase_punch_aura::HandlePeriodic(), spell_algalon_remove_phase_aura::HandlePeriodic(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicDummyAuraTick(), AuraEffect::HandlePeriodicTriggerSpellAuraTick(), OutdoorPvPEP::HandlePlayerLeaveZone(), OutdoorPvPHP::HandlePlayerLeaveZone(), OutdoorPvPNA::HandlePlayerLeaveZone(), OutdoorPvPSI::HandlePlayerLeaveZone(), OutdoorPvPTF::HandlePlayerLeaveZone(), OutdoorPvPZM::HandlePlayerLeaveZone(), spell_gen_consume::HandleProc(), spell_pri_t4_4p_bonus::HandleProc(), spell_item_blood_draining_enchant::HandleProc(), HandleProcTriggerSpell(), spell_icc_harvest_blight_specimen::HandleQuestComplete(), spell_felmyst_fog_of_corruption_charm_aura::HandleRemove(), spell_kiljaeden_vengeance_of_the_blue_flight_aura::HandleRemove(), spell_dru_enrage::HandleRemove(), spell_pal_divine_intervention::HandleRemove(), spell_pal_avenging_wrath::HandleRemove(), spell_rog_killing_spree_aura::HandleRemove(), spell_warr_vigilance::HandleRemove(), WorldSession::HandleRemoveGlyph(), spell_najentus_hurl_spine::HandleSchoolDamage(), spell_putricide_clear_aura_effect_value::HandleScript(), spell_the_lich_king_jump::HandleScript(), spell_the_lich_king_jump_remove_aura::HandleScript(), spell_icc_harvest_blight_specimen::HandleScript(), spell_festergut_pungent_blight::HandleScript(), spell_festergut_gastric_bloat::HandleScript(), spell_putricide_unbound_plague::HandleScript(), spell_putricide_eat_ooze::HandleScript(), spell_rotface_little_ooze_combine::HandleScript(), spell_rotface_large_ooze_combine::HandleScript(), spell_rotface_large_ooze_buff_combine::HandleScript(), spell_q10651_q10692_book_of_fel_names::HandleScript(), spell_halion_clear_debuffs::HandleScriptEffect(), spell_q12823_remove_collapsing_cave_aura::HandleScriptEffect(), spell_illidari_council_judgement::HandleScriptEffect(), AuraEffect::HandleShapeshiftBoosts(), ArenaSpectator::HandleSpectatorWatchCommand(), AuraEffect::HandleSpiritOfRedemption(), spell_capacitus_polarity_charge::HandleTargets(), misc_commandscript::HandleUnAuraCommand(), misc_commandscript::HandleUnFreezeCommand(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::HealReceived(), npc_underbog_mushroom::InitializeAI(), npc_demon_chain::JustDied(), boss_azuregos::boss_azuregosAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_bronjahm::boss_bronjahmAI::JustEngagedWith(), boss_doomwalker::JustEngagedWith(), boss_gruul::JustEngagedWith(), boss_pathaleon_the_calculator::JustEngagedWith(), npc_pet_shaman_fire_elemental::JustEngagedWith(), boss_the_lich_king::boss_the_lich_kingAI::JustEngagedWith(), boss_jeklik::JustEngagedWith(), boss_buru::JustEngagedWith(), boss_gal_darah::boss_gal_darahAI::JustEngagedWith(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustEngagedWith(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustEngagedWith(), boss_prince_valanar_icc::boss_prince_valanarAI::JustEngagedWith(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::JustEngagedWith(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustEngagedWith(), boss_hydross_the_unstable::JustReachedHome(), boss_garfrost::boss_garfrostAI::MovementInform(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), boss_shade_of_akama::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), npc_image_of_medivh::npc_image_of_medivhAI::NextStep(), spell_halion_twilight_realm_aura::OnApply(), spell_halion_leave_twilight_realm_aura::OnApply(), spell_systems_shutdown_aura::OnApply(), npc_chesspiece::OnCharmed(), npc_eye_of_acherus::OnCharmed(), npc_aged_dying_ancient_kodo::OnGossipHello(), lfg::LFGPlayerScript::OnMapChanged(), spell_yogg_saron_empowered_aura::OnPeriodic(), spell_gen_curse_of_pain::OnPeriodic(), spell_illidan_demon_transform2_aura::OnPeriodic(), BattlefieldWG::OnPlayerLeaveZone(), boss_shade_of_aran::OnPowerUpdate(), spell_halion_combustion_consumption_aura::OnRemove(), spell_halion_leave_twilight_realm_aura::OnRemove(), spell_algalon_phase_punch_aura::OnRemove(), spell_load_into_catapult_aura::OnRemove(), spell_gen_damage_reduction_aura::OnRemove(), spell_hun_ascpect_of_the_viper::OnRemove(), spell_hun_viper_attack_speed::OnRemove(), spell_item_with_mount_speed::OnRemove(), spell_item_desperate_defense::OnRemove(), spell_item_shadowmourne::OnRemove(), spell_item_shadowmourne_soul_fragment::OnRemove(), spell_mage_combustion_proc::OnRemove(), spell_item_shadowmourne_soul_fragment::OnStackChange(), MidsummerPlayerScript::OnUpdateZone(), npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::PassengerBoarded(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::PassengerBoarded(), boss_jeklik::PathEndReached(), ProcessTerrainStatusUpdate(), spell_gen_defend::RefreshVisualShields(), RemoveAurasDueToSpellByDispel(), BattlefieldWG::RemoveAurasFromPlayer(), boss_festergut::boss_festergutAI::RemoveBlight(), spell_warl_health_funnel::RemoveEffect(), RemoveGameObject(), BattlegroundAV::RemovePlayer(), Battleground::RemovePlayerFromResurrectQueue(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), Pet::removeSpell(), Player::removeSpell(), spell_gen_eject_all_passengers::RemoveVehicleAuras(), spell_gen_defend::RemoveVisualShields(), boss_malchezaar::Reset(), npc_mograine::npc_mograineAI::Reset(), boss_baroness_anastari::boss_baroness_anastariAI::Reset(), boss_twilight_corrupter::Reset(), boss_nalorakk::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_thekal::Reset(), boss_cthun::Reset(), boss_viscidus::Reset(), boss_halion::boss_halionAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_leotheras_the_blind::Reset(), boss_lethon::boss_lethonAI::Reset(), boss_taerar::boss_taerarAI::Reset(), boss_high_botanist_freywinn::ResumeEncounter(), Player::ResurrectPlayer(), npc_finklestein::npc_finklesteinAI::RightClickCauldron(), boss_magtheridon::ScheduleCombatEvents(), boss_supremus::SchedulePhase(), boss_laj::ScheduleTasks(), Player::SendQuestUpdate(), npc_corrupted_totem::SetAura(), OPvPCapturePointZM_GraveYard::SetBeaconState(), boss_hydross_the_unstable::SetForm(), Player::SetGMVisible(), boss_mandokir::boss_mandokirAI::SetGUID(), Player::SetIsSpectator(), SetModelVisible(), npc_akama_shade::sGossipSelect(), boss_nalorakk::ShapeShift(), boss_viscidus::SoftReset(), boss_ossirian::SpellHit(), npc_omen::npc_omenAI::SpellHit(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_troll_volunteer::npc_troll_volunteerAI::SpellHit(), boss_sister_svalna::boss_sister_svalnaAI::SpellHit(), boss_faerlina::boss_faerlinaAI::SpellHit(), boss_moorabi::boss_moorabiAI::SpellHitTarget(), boss_festergut::boss_festergutAI::SpellHitTarget(), boss_ahune::Submerge(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_cthun::SummonedCreatureDies(), npc_kiljaeden_controller::npc_kiljaeden_controllerAI::SummonedCreatureDies(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), boss_anzu::SummonedCreatureDies(), boss_viscidus::SummonedCreatureDies(), boss_terestian_illhoof::SummonKilrek(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), boss_netherspite::SwitchToBanishPhase(), boss_netherspite::SwitchToPortalPhase(), Totem::UnSummon(), spell_black_temple_spell_absorption_aura::Update(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_eye_of_acherus::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), npc_singularity::npc_singularityAI::UpdateAI(), boss_renataki::boss_renatakiAI::UpdateAI(), boss_moam::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_draenei_survivor::npc_draenei_survivorAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_freya_lifebinder::boss_freya_lifebinderAI::UpdateAI(), boss_freya_healthy_spore::boss_freya_healthy_sporeAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_anzu::UpdateAI(), npc_pet_gen_soul_trader_beacon::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), npc_pet_darting_hatchling::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::UpdateAI(), and Player::UpdateTitansGrip().

◆ RemoveAurasDueToSpellByDispel()

void Unit::RemoveAurasDueToSpellByDispel ( uint32  spellId,
uint32  dispellerSpellId,
ObjectGuid  casterGUID,
Unit dispeller,
uint8  chargesRemoved = 1 
)
4905{
4906 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4907 for (AuraMap::iterator iter = range.first; iter != range.second;)
4908 {
4909 Aura* aura = iter->second;
4910 if (aura->GetCasterGUID() == casterGUID)
4911 {
4912 DispelInfo dispelInfo(dispeller, dispellerSpellId, chargesRemoved);
4913
4914 // Call OnDispel hook on AuraScript
4915 aura->CallScriptDispel(&dispelInfo);
4916
4918 aura->ModCharges(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
4919 else
4920 aura->ModStackAmount(-dispelInfo.GetRemovedCharges(), AURA_REMOVE_BY_ENEMY_SPELL);
4921
4922 // Call AfterDispel hook on AuraScript
4923 aura->CallScriptAfterDispel(&dispelInfo);
4924
4925 switch (aura->GetSpellInfo()->SpellFamilyName)
4926 {
4927 case SPELLFAMILY_HUNTER:
4928 {
4929 // Noxious Stings
4930 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x1000)
4931 {
4932 if (Unit* caster = aura->GetCaster())
4933 {
4934 if (AuraEffect* aureff = caster->GetAuraEffect(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_HUNTER, 3521, 1))
4935 {
4936 if (Aura* noxious = Aura::TryCreate(aura->GetSpellInfo(), aura->GetEffectMask(), dispeller, caster))
4937 {
4938 noxious->SetDuration(aura->GetDuration() * aureff->GetAmount() / 100);
4939 if (aura->GetUnitOwner() )
4940 if (const std::vector<int32>* spell_triggered = sSpellMgr->GetSpellLinked(-int32(aura->GetId())))
4941 for (std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
4942 aura->GetUnitOwner()->RemoveAurasDueToSpell(*itr);
4943 }
4944 }
4945 }
4946 }
4947 break;
4948 }
4950 {
4951 // Icy Clutch, remove with Frost Fever
4952 if (aura->GetSpellInfo()->SpellFamilyFlags[1] & 0x4000000)
4953 {
4954 if (AuraEffect* aureff = GetAuraEffect(SPELL_AURA_MOD_DECREASE_SPEED, SPELLFAMILY_DEATHKNIGHT, 0, 0x40000, 0, casterGUID))
4955 RemoveAurasDueToSpell(aureff->GetId());
4956 }
4957 }
4958 default:
4959 break;
4960 }
4961 return;
4962 }
4963 else
4964 ++iter;
4965 }
4966}
Definition: Unit.h:296
void CallScriptDispel(DispelInfo *dispelInfo)
Definition: SpellAuras.cpp:2390
static Aura * TryCreate(SpellInfo const *spellproto, uint8 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount=nullptr, Item *castItem=nullptr, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemGUID=ObjectGuid::Empty)
Definition: SpellAuras.cpp:352
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: SpellAuras.cpp:973
void CallScriptAfterDispel(DispelInfo *dispelInfo)
Definition: SpellAuras.cpp:2403

References AURA_REMOVE_BY_ENEMY_SPELL, Aura::CallScriptAfterDispel(), Aura::CallScriptDispel(), GetAuraEffect(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetDuration(), Aura::GetEffectMask(), Aura::GetId(), DispelInfo::GetRemovedCharges(), Aura::GetSpellInfo(), Aura::GetUnitOwner(), SpellInfo::HasAttribute(), m_ownedAuras, Aura::ModCharges(), Aura::ModStackAmount(), RemoveAurasDueToSpell(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_HUNTER, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sSpellMgr, and Aura::TryCreate().

Referenced by Spell::EffectDispel().

◆ RemoveAurasDueToSpellBySteal()

void Unit::RemoveAurasDueToSpellBySteal ( uint32  spellId,
ObjectGuid  casterGUID,
Unit stealer 
)
4969{
4970 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4971 for (AuraMap::iterator iter = range.first; iter != range.second;)
4972 {
4973 Aura* aura = iter->second;
4974 if (aura->GetCasterGUID() == casterGUID)
4975 {
4976 int32 damage[MAX_SPELL_EFFECTS];
4977 int32 baseDamage[MAX_SPELL_EFFECTS];
4978 uint8 effMask = 0;
4979 uint8 recalculateMask = 0;
4980 Unit* caster = aura->GetCaster();
4981 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
4982 {
4983 if (aura->GetEffect(i))
4984 {
4985 baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
4986 damage[i] = aura->GetEffect(i)->GetAmount();
4987 effMask |= (1 << i);
4988 if (aura->GetEffect(i)->CanBeRecalculated())
4989 recalculateMask |= (1 << i);
4990 }
4991 else
4992 {
4993 baseDamage[i] = 0;
4994 damage[i] = 0;
4995 }
4996 }
4997
4999 // Cast duration to unsigned to prevent permanent aura's such as Righteous Fury being permanently added to caster
5000 uint32 dur = std::min(2u * MINUTE * IN_MILLISECONDS, uint32(aura->GetDuration()));
5001
5002 if (Aura* oldAura = stealer->GetAura(aura->GetId(), aura->GetCasterGUID()))
5003 {
5004 if (stealCharge)
5005 oldAura->ModCharges(1);
5006 else
5007 oldAura->ModStackAmount(1);
5008 oldAura->SetDuration(int32(dur));
5009 }
5010 else
5011 {
5012 // single target state must be removed before aura creation to preserve existing single target aura
5013 if (aura->IsSingleTarget())
5014 aura->UnregisterSingleTarget();
5015
5016 // Xinef: if stealer has same aura
5017 Aura* curAura = stealer->GetAura(aura->GetId());
5018 if (!curAura || (!curAura->IsPermanent() && curAura->GetDuration() < (int32)dur))
5019 if (Aura* newAura = Aura::TryRefreshStackOrCreate(aura->GetSpellInfo(), effMask, stealer, nullptr, &baseDamage[0], nullptr, aura->GetCasterGUID()))
5020 {
5021 // created aura must not be single target aura,, so stealer won't loose it on recast
5022 if (newAura->IsSingleTarget())
5023 {
5024 newAura->UnregisterSingleTarget();
5025 // bring back single target aura status to the old aura
5026 aura->SetIsSingleTarget(true);
5027 caster->GetSingleCastAuras().push_back(aura);
5028 }
5029 // FIXME: using aura->GetMaxDuration() maybe not blizzlike but it fixes stealing of spells like Innervate
5030 newAura->SetLoadedState(aura->GetMaxDuration(), int32(dur), stealCharge ? 1 : aura->GetCharges(), 1, recalculateMask, &damage[0]);
5031 newAura->ApplyForTargets();
5032 }
5033 }
5034
5035 if (stealCharge)
5037 else
5039
5040 return;
5041 }
5042 else
5043 ++iter;
5044 }
5045}
bool CanBeRecalculated() const
Definition: SpellAuraEffects.h:78
int32 GetBaseAmount() const
Definition: SpellAuraEffects.h:57
void UnregisterSingleTarget()
Definition: SpellAuras.cpp:1167
bool IsPermanent() const
Definition: SpellAuras.h:139

References AURA_REMOVE_BY_ENEMY_SPELL, AuraEffect::CanBeRecalculated(), AuraEffect::GetAmount(), GetAura(), AuraEffect::GetBaseAmount(), Aura::GetCaster(), Aura::GetCasterGUID(), Aura::GetCharges(), Aura::GetDuration(), Aura::GetEffect(), Aura::GetId(), Aura::GetMaxDuration(), GetSingleCastAuras(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), IN_MILLISECONDS, Aura::IsPermanent(), Aura::IsSingleTarget(), m_ownedAuras, MAX_SPELL_EFFECTS, MINUTE, Aura::ModCharges(), Aura::ModStackAmount(), Aura::SetIsSingleTarget(), SPELL_ATTR7_DISPEL_REMOVES_CHARGES, Aura::TryRefreshStackOrCreate(), and Aura::UnregisterSingleTarget().

Referenced by Spell::EffectStealBeneficialBuff().

◆ RemoveAurasWithAttribute()

void Unit::RemoveAurasWithAttribute ( uint32  flags)
5085{
5086 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5087 {
5088 SpellInfo const* spell = iter->second->GetBase()->GetSpellInfo();
5089 if (spell->Attributes & flags)
5090 RemoveAura(iter);
5091 else
5092 ++iter;
5093 }
5094}

References SpellInfo::Attributes, m_appliedAuras, and RemoveAura().

◆ RemoveAurasWithFamily()

void Unit::RemoveAurasWithFamily ( SpellFamilyNames  family,
uint32  familyFlag1,
uint32  familyFlag2,
uint32  familyFlag3,
ObjectGuid  casterGUID 
)
5168{
5169 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5170 {
5171 Aura const* aura = iter->second->GetBase();
5172 if (!casterGUID || aura->GetCasterGUID() == casterGUID)
5173 {
5174 SpellInfo const* spell = aura->GetSpellInfo();
5175 if (spell->SpellFamilyName == uint32(family) && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
5176 {
5177 RemoveAura(iter);
5178 continue;
5179 }
5180 }
5181 ++iter;
5182 }
5183}

References Aura::GetCasterGUID(), Aura::GetSpellInfo(), flag96::HasFlag(), m_appliedAuras, RemoveAura(), SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Referenced by spell_warl_demonic_aegis::HandleAuraApply(), and Aura::HandleAuraSpecificMods().

◆ RemoveAurasWithInterruptFlags()

void Unit::RemoveAurasWithInterruptFlags ( uint32  flag,
uint32  except = 0,
bool  isAutoshot = false 
)
5133{
5134 if (!(m_interruptMask & flag))
5135 return;
5136
5137 // interrupt auras
5138 for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end();)
5139 {
5140 Aura* aura = (*iter)->GetBase();
5141 ++iter;
5142 if ((aura->GetSpellInfo()->AuraInterruptFlags & flag) && (!except || aura->GetId() != except))
5143 {
5144 uint32 removedAuras = m_removedAurasCount;
5145 RemoveAura(aura);
5146 if (m_removedAurasCount > removedAuras + 1)
5147 iter = m_interruptableAuras.begin();
5148 }
5149 }
5150
5151 // interrupt channeled spell
5153 {
5154 if (spell->getState() == SPELL_STATE_CASTING && (spell->m_spellInfo->ChannelInterruptFlags & flag) && spell->m_spellInfo->Id != except)
5155 {
5156 // Do not interrupt if auto shot
5157 if (!(isAutoshot && spell->m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS)))
5158 {
5159 InterruptNonMeleeSpells(false, spell->m_spellInfo->Id);
5160 }
5161 }
5162 }
5163
5165}

References SpellInfo::AuraInterruptFlags, CURRENT_CHANNELED_SPELL, Aura::GetId(), Aura::GetSpellInfo(), InterruptNonMeleeSpells(), m_currentSpells, m_interruptableAuras, m_interruptMask, m_removedAurasCount, RemoveAura(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_STATE_CASTING, and UpdateInterruptMask().

Referenced by _EnterVehicle(), AttackerStateUpdate(), ClearInPetCombat(), CombatStart(), CombatStartOnCast(), DealDamage(), Dismount(), Spell::DoAllEffectOnTarget(), Spell::DoSpellHitOnUnit(), BattlegroundWS::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerCapturedFlag(), BattlegroundEY::EventPlayerClickedOnFlag(), BattlegroundWS::EventPlayerClickedOnFlag(), BattlegroundAB::EventPlayerClickedOnFlag(), spell_rog_killing_spree::FilterTargets(), AuraEffect::HandleAuraModSchoolImmunity(), AuraEffect::HandleFeignDeath(), WorldSession::HandleGossipHelloOpcode(), AuraEffect::HandleModInvisibility(), AuraEffect::HandleModStealth(), AuraEffect::HandleModUnattackable(), WorldSession::HandleMovementOpcodes(), AuraEffect::HandlePeriodicManaLeechAuraTick(), AuraEffect::HandlePhase(), Player::LoadFromDB(), WorldSession::LogoutPlayer(), Mount(), Spell::prepare(), ProcessTerrainStatusUpdate(), Player::SetInWater(), SetStandState(), Player::TeleportTo(), and UpdatePosition().

◆ RemoveAurasWithMechanic()

void Unit::RemoveAurasWithMechanic ( uint32  mechanic_mask,
AuraRemoveMode  removemode = AURA_REMOVE_BY_DEFAULT,
uint32  except = 0 
)
5205{
5206 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5207 {
5208 Aura const* aura = iter->second->GetBase();
5209 if (!except || aura->GetId() != except)
5210 {
5211 if (aura->GetSpellInfo()->GetAllEffectsMechanicMask() & mechanic_mask)
5212 {
5213 RemoveAura(iter, removemode);
5214 continue;
5215 }
5216 }
5217 ++iter;
5218 }
5219}

References SpellInfo::GetAllEffectsMechanicMask(), Aura::GetId(), Aura::GetSpellInfo(), m_appliedAuras, and RemoveAura().

Referenced by HandleDummyAuraProc(), AuraEffect::HandleModMechanicImmunity(), AuraEffect::HandleModStateImmunityMask(), spell_rog_vanish_purge::HandleRootRemove(), spell_rog_vanish_purge::HandleSnareRemove(), and RemoveMovementImpairingAuras().

◆ RemoveBindSightAuras()

void Unit::RemoveBindSightAuras ( )
11128{
11130}
@ SPELL_AURA_BIND_SIGHT
Definition: SpellAuraDefines.h:64

References RemoveAurasByType(), and SPELL_AURA_BIND_SIGHT.

Referenced by RemoveFromWorld().

◆ RemoveCharmAuras()

void Unit::RemoveCharmAuras ( )
11133{
11138}
@ SPELL_AURA_MOD_POSSESS_PET
Definition: SpellAuraDefines.h:191
@ SPELL_AURA_MOD_CHARM
Definition: SpellAuraDefines.h:69
@ SPELL_AURA_AOE_CHARM
Definition: SpellAuraDefines.h:240
@ SPELL_AURA_MOD_POSSESS
Definition: SpellAuraDefines.h:65

References RemoveAurasByType(), SPELL_AURA_AOE_CHARM, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_POSSESS, and SPELL_AURA_MOD_POSSESS_PET.

Referenced by misc_commandscript::HandleUnPossessCommand(), RemoveAllControlled(), RemoveFromWorld(), and Creature::Update().

◆ RemoveCharmedBy()

void Unit::RemoveCharmedBy ( Unit charmer)
18470{
18471 if (!IsCharmed())
18472 return;
18473
18474 if (!charmer)
18475 charmer = GetCharmer();
18476 if (charmer != GetCharmer()) // one aura overrides another?
18477 {
18478 // LOG_FATAL("entities.unit", "Unit::RemoveCharmedBy: this: {} true charmer: {} false charmer: {}",
18479 // GetGUID().ToString(), GetCharmerGUID().ToString(), charmer->GetGUID().ToString());
18480 // ABORT();
18481 return;
18482 }
18483
18484 CharmType type;
18486 type = CHARM_TYPE_POSSESS;
18487 else if (charmer && charmer->IsOnVehicle(this))
18488 type = CHARM_TYPE_VEHICLE;
18489 else
18490 type = CHARM_TYPE_CHARM;
18491
18492 if (_oldFactionId)
18493 {
18495 _oldFactionId = 0;
18496 }
18497 else
18499
18500 CastStop();
18501 AttackStop();
18502
18503 // xinef: update speed after charming
18504 UpdateSpeed(MOVE_RUN, false);
18505
18506 // xinef: do not break any controlled motion slot
18507 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
18508 {
18509 StopMoving();
18511 }
18512 // xinef: if we have any controlled movement, clear active and idle only
18513 else
18515
18517
18518 // xinef: remove stunned flag if owner was mounted
18521
18522 // If charmer still exists
18523 if (!charmer)
18524 return;
18525
18526 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
18528
18529 charmer->SetCharm(this, false);
18530
18532
18533 Player* playerCharmer = charmer->ToPlayer();
18534 if (playerCharmer)
18535 {
18536 switch (type)
18537 {
18538 case CHARM_TYPE_VEHICLE:
18539 playerCharmer->SetClientControl(this, false);
18540 playerCharmer->SetClientControl(charmer, true); // verified
18543 break;
18544 case CHARM_TYPE_POSSESS:
18545 playerCharmer->SetClientControl(this, false);
18546 playerCharmer->SetClientControl(charmer, true); // verified
18551 break;
18552 case CHARM_TYPE_CHARM:
18554 {
18556 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
18557 {
18559 if (GetCharmInfo())
18560 GetCharmInfo()->SetPetNumber(0, true);
18561 else
18562 LOG_ERROR("entities.unit", "Aura::HandleModCharm: target={} has a charm aura but no charm info!", GetGUID().ToString());
18563 }
18564 }
18565 break;
18566 default:
18567 break;
18568 }
18569 }
18570
18571 if (Player* player = ToPlayer())
18572 {
18573 sScriptMgr->AnticheatSetUnderACKmount(player);
18574 }
18575
18576 // xinef: restore threat
18577 for (CharmThreatMap::const_iterator itr = _charmThreatInfo.begin(); itr != _charmThreatInfo.end(); ++itr)
18578 {
18579 if (Unit* target = ObjectAccessor::GetUnit(*this, itr->first))
18580 if (!IsFriendlyTo(target))
18581 AddThreat(target, itr->second);
18582 }
18583
18584 _charmThreatInfo.clear();
18585
18586 if (Creature* creature = ToCreature())
18587 {
18588 // Vehicle should not attack its passenger after he exists the seat
18589 if (type != CHARM_TYPE_VEHICLE && charmer->IsAlive() && !charmer->IsFriendlyTo(creature))
18590 if (Attack(charmer, true))
18591 GetMotionMaster()->MoveChase(charmer);
18592
18593 // Creature will restore its old AI on next update
18594 if (creature->AI())
18595 creature->AI()->OnCharmed(false);
18596
18597 // Xinef: Remove movement flag flying
18599 }
18600 else
18601 ToPlayer()->SetClientControl(this, true); // verified
18602
18603 // a guardian should always have charminfo
18604 if (playerCharmer && this != charmer->GetFirstControlled())
18605 playerCharmer->SendRemoveControlBar();
18606
18607 // xinef: Always delete charm info (restores react state)
18608 if (IsPlayer() || (GetTypeId() == TYPEID_UNIT && !ToCreature()->IsGuardian()))
18610}
CharmType
Definition: CharmInfo.h:43
@ CHARM_TYPE_CHARM
Definition: CharmInfo.h:44
@ CHARM_TYPE_POSSESS
Definition: CharmInfo.h:45
@ CHARM_TYPE_VEHICLE
Definition: CharmInfo.h:46
@ CLASS_CONTEXT_PET_CHARM
Definition: UnitDefines.h:216
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition: UnitDefines.h:177
@ MOVE_RUN
Definition: UnitDefines.h:329
@ UNIT_FLAG_DISABLE_MOVE
Definition: UnitDefines.h:231
@ MOTION_SLOT_CONTROLLED
Definition: MotionMaster.h:63
@ MOTION_SLOT_ACTIVE
Definition: MotionMaster.h:62
@ NULL_MOTION_TYPE
Definition: MotionMaster.h:56
@ CREATURE_TYPE_DEMON
Definition: SharedDefines.h:2630
uint32 unit_class
Definition: CreatureData.h:216
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void SendRemoveControlBar()
Definition: Player.cpp:9653
void SetClientControl(Unit *target, bool allowMove, bool packetOnly=false)
Definition: Player.cpp:12802
void DeleteCharmInfo()
Definition: Unit.cpp:15747
void RestoreFaction()
Definition: Unit.cpp:18612
void SetCharm(Unit *target, bool apply)
Definition: Unit.cpp:10811
void StopAttackingInvalidTarget()
Definition: Unit.cpp:20120
void CastStop(uint32 except_spellid=0, bool withInstant=true)
Interrupt the unit cast for all the current spells.
Definition: Unit.cpp:1147
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:10214
CharmThreatMap _charmThreatInfo
Definition: Unit.h:1875
void RemoveUnitMovementFlag(uint32 f)
Definition: Unit.h:1616
void UpdateSpeed(UnitMoveType mtype, bool forced)
Definition: Unit.cpp:14179
void InitDefault()
Definition: MotionMaster.cpp:87
void MovementExpiredOnSlot(MovementSlot slot, bool reset=true)
Definition: MotionMaster.h:192
void MovementExpired(bool reset=true)
Definition: MotionMaster.h:178

References _charmThreatInfo, _oldFactionId, AddThreat(), ASSERT, Attack(), AttackStop(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, CLASS_CONTEXT_PET_CHARM, CLASS_WARLOCK, ClearUnitState(), CREATURE_TYPE_DEMON, DeleteCharmInfo(), GetCharmer(), GetCharmInfo(), Creature::GetCreatureTemplate(), GetFirstControlled(), Object::GetGUID(), GetMotionMaster(), Object::GetTypeId(), ObjectAccessor::GetUnit(), HasUnitState(), MotionMaster::InitDefault(), IsAlive(), IsCharmed(), IsClass(), IsFriendlyTo(), IsGuardian(), IsOnVehicle(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MOTION_SLOT_ACTIVE, MOTION_SLOT_CONTROLLED, MOVE_RUN, MotionMaster::MoveChase(), MotionMaster::MovementExpired(), MotionMaster::MovementExpiredOnSlot(), MOVEMENTFLAG_FLYING, NULL_MOTION_TYPE, RemoveUnitFlag(), RemoveUnitMovementFlag(), RestoreFaction(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), sScriptMgr, StopAttackingInvalidTarget(), StopMoving(), Object::ToCreature(), Object::ToPlayer(), Position::ToString(), CreatureTemplate::type, TYPEID_UNIT, CreatureTemplate::unit_class, UNIT_FIELD_BYTES_0, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_FLAG_STUNNED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, UNIT_STATE_STUNNED, and UpdateSpeed().

Referenced by AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), npc_chesspiece::JustDied(), Puppet::RemoveFromWorld(), Vehicle::RemovePassenger(), and npc_chesspiece::sGossipSelect().

◆ RemoveComboPointHolder()

void Unit::RemoveComboPointHolder ( Unit unit)
inline
1643{ m_ComboPointHolders.erase(unit); }

References m_ComboPointHolders.

Referenced by AddComboPoints(), and ClearComboPoints().

◆ RemoveDynObject()

bool Unit::RemoveDynObject ( uint32  spellId)
6093{
6094 if (m_dynObj.empty())
6095 return false;
6096
6097 bool result = false;
6098 for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
6099 {
6100 DynamicObject* dynObj = *i;
6101 if (dynObj->GetSpellId() == spellId)
6102 {
6103 dynObj->Remove();
6104 i = m_dynObj.begin();
6105 result = true;
6106 }
6107 else
6108 ++i;
6109 }
6110
6111 return result;
6112}
void Remove()
Definition: DynamicObject.cpp:187

References DynamicObject::GetSpellId(), m_dynObj, and DynamicObject::Remove().

Referenced by Spell::cancel(), Spell::EffectAddFarsight(), and spell_item_shifting_naaru_silver::OnBaseRemove().

◆ RemoveEvadeAuras()

void Unit::RemoveEvadeAuras ( )
5389{
5390 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5391 {
5392 Aura const* aura = iter->second->GetBase();
5393 SpellInfo const* spellInfo = aura->GetSpellInfo();
5395 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5396 ++iter;
5397 else
5399 }
5400
5401 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5402 {
5403 Aura* aura = iter->second;
5404 SpellInfo const* spellInfo = aura->GetSpellInfo();
5406 || spellInfo->HasAura(SPELL_AURA_CLONE_CASTER) || (aura->IsPassive() && GetOwnerGUID().IsPlayer()))
5407 ++iter;
5408 else
5410 }
5411}
@ SPELL_AURA_CLONE_CASTER
Definition: SpellAuraDefines.h:310
@ SPELL_ATTR0_CU_IGNORE_EVADE
Definition: SpellInfo.h:187
@ SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT
Definition: SharedDefines.h:444

References _UnapplyAura(), AURA_REMOVE_BY_DEFAULT, GetOwnerGUID(), Aura::GetSpellInfo(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), Aura::IsPassive(), Object::IsPlayer(), m_appliedAuras, m_ownedAuras, RemoveOwnedAura(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CLONE_CASTER, and SPELL_AURA_CONTROL_VEHICLE.

Referenced by CreatureAI::_EnterEvadeMode(), and npc_pos_freed_slave::npc_pos_freed_slaveAI::EnterEvadeMode().

◆ RemoveExtraUnitMovementFlag()

void Unit::RemoveExtraUnitMovementFlag ( uint16  f)
inline

◆ removeFollower()

void Unit::removeFollower ( FollowerReference )
inline
1603{ /* nothing to do yet */ }

Referenced by FollowerReference::targetObjectDestroyLink().

◆ RemoveFromWorld()

void Unit::RemoveFromWorld ( )
overridevirtual

Reimplemented from WorldObject.

15624{
15625 // cleanup
15626 ASSERT(GetGUID());
15627
15628 if (IsInWorld())
15629 {
15631 if (IsVehicle())
15633
15637
15640
15641 ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
15644
15646
15647 if (GetCharmerGUID())
15648 {
15649 LOG_FATAL("entities.unit", "Unit {} has charmer guid when removed from world", GetEntry());
15650 ABORT();
15651 }
15652
15653 if (Unit* owner = GetOwner())
15654 {
15655 if (owner->m_Controlled.find(this) != owner->m_Controlled.end())
15656 {
15658 owner->SetMinion((Minion*)this, false);
15659 LOG_INFO("entities.unit", "Unit {} is in controlled list of {} when removed from world", GetEntry(), owner->GetEntry());
15660 //ABORT();
15661 }
15662 }
15663
15666 }
15667}
void RemoveFromWorld() override
Definition: Object.cpp:1182
void RemoveNotOwnSingleTargetAuras()
Definition: Unit.cpp:5096
void UnsummonAllTotems(bool onDeath=false)
Definition: Unit.cpp:11140
void RemoveAllDynObjects()
Definition: Unit.cpp:6114
void RemoveAreaAurasDueToLeaveWorld()
Definition: Unit.cpp:5237
void RemoveBindSightAuras()
Definition: Unit.cpp:11127
void RemoveAllControlled(bool onDeath=false)
Definition: Unit.cpp:11021

References ABORT, ASSERT, ExitVehicle(), GetCharmerGUID(), Object::GetEntry(), Object::GetGUID(), GetOwner(), HasUnitTypeMask(), Object::IsInWorld(), IsVehicle(), LOG_FATAL, LOG_INFO, m_duringRemoveFromWorld, RemoveAllControlled(), RemoveAllDynObjects(), RemoveAllGameObjects(), RemoveAreaAurasDueToLeaveWorld(), RemoveBindSightAuras(), RemoveCharmAuras(), WorldObject::RemoveFromWorld(), RemoveNotOwnSingleTargetAuras(), RemoveVehicleKit(), UNIT_MASK_GUARDIAN, UNIT_MASK_MINION, and UnsummonAllTotems().

Referenced by CleanupBeforeRemoveFromMap(), Creature::RemoveFromWorld(), Pet::RemoveFromWorld(), and Player::RemoveFromWorld().

◆ RemoveGameObject() [1/2]

void Unit::RemoveGameObject ( GameObject gameObj,
bool  del 
)
6149{
6150 if (!gameObj || gameObj->GetOwnerGUID() != GetGUID())
6151 return;
6152
6154
6155 for (uint8 i = 0; i < MAX_GAMEOBJECT_SLOT; ++i)
6156 {
6157 if (m_ObjectSlot[i] == gameObj->GetGUID())
6158 {
6159 m_ObjectSlot[i].Clear();
6160 break;
6161 }
6162 }
6163
6164 // GO created by some spell
6165 if (uint32 spellid = gameObj->GetSpellId())
6166 {
6167 RemoveAurasDueToSpell(spellid);
6168
6169 if (IsPlayer())
6170 {
6171 SpellInfo const* createBySpell = sSpellMgr->GetSpellInfo(spellid);
6172 // Need activate spell use for owner
6173 if (createBySpell && createBySpell->IsCooldownStartedOnEvent())
6174 // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
6175 ToPlayer()->SendCooldownEvent(createBySpell);
6176 }
6177 }
6178
6179 m_gameObj.remove(gameObj->GetGUID());
6180
6181 if (del)
6182 {
6183 gameObj->SetRespawnTime(0);
6184 gameObj->Delete();
6185 }
6186}
void Clear()
Definition: ObjectGuid.h:138
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool setCooldown=true)
Definition: Player.cpp:11061

References ObjectGuid::Clear(), GameObject::Delete(), ObjectGuid::Empty, Object::GetGUID(), GameObject::GetOwnerGUID(), GameObject::GetSpellId(), SpellInfo::IsCooldownStartedOnEvent(), Object::IsPlayer(), m_gameObj, m_ObjectSlot, MAX_GAMEOBJECT_SLOT, RemoveAurasDueToSpell(), Player::SendCooldownEvent(), GameObject::SetOwnerGUID(), GameObject::SetRespawnTime(), sSpellMgr, and Object::ToPlayer().

Referenced by Spell::cancel(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), Spell::EffectSummonObject(), gobject_commandscript::HandleGameObjectDeleteCommand(), spell_warl_demonic_circle_summon::HandleRemove(), boss_kologarn::boss_kologarnAI::JustDied(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::JustDied(), npc_ulduar_harpoonfirestate::npc_ulduar_harpoonfirestateAI::SetData(), GameObject::Update(), and npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI().

◆ RemoveGameObject() [2/2]

void Unit::RemoveGameObject ( uint32  spellid,
bool  del 
)
6189{
6190 if (m_gameObj.empty())
6191 return;
6192
6193 for (GameObjectList::iterator itr = m_gameObj.begin(); itr != m_gameObj.end();)
6194 {
6195 if (GameObject* go = ObjectAccessor::GetGameObject(*this, *itr))
6196 {
6197 if (spellid > 0 && go->GetSpellId() != spellid)
6198 {
6199 ++itr;
6200 continue;
6201 }
6202
6203 go->SetOwnerGUID(ObjectGuid::Empty);
6204 if(del)
6205 {
6206 go->SetRespawnTime(0);
6207 go->Delete();
6208 }
6209 }
6210 m_gameObj.erase(itr++);
6211 }
6212}

References ObjectGuid::Empty, ObjectAccessor::GetGameObject(), and m_gameObj.

◆ removeHatedBy()

void Unit::removeHatedBy ( HostileReference )
inline
1491{ /* nothing to do yet */ }

Referenced by HostileReference::targetObjectDestroyLink().

◆ RemoveMovementImpairingAuras()

void Unit::RemoveMovementImpairingAuras ( bool  withRoot)
5186{
5187 if (withRoot)
5189
5190 // Snares
5191 for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
5192 {
5193 Aura const* aura = iter->second->GetBase();
5195 {
5196 RemoveAura(iter);
5197 continue;
5198 }
5199
5200 ++iter;
5201 }
5202}
bool HasEffectMechanic(Mechanics mechanic) const
Definition: SpellInfo.cpp:883

References Aura::GetSpellInfo(), SpellInfo::HasEffectMechanic(), m_appliedAuras, SpellInfo::Mechanic, MECHANIC_ROOT, MECHANIC_SNARE, RemoveAura(), and RemoveAurasWithMechanic().

Referenced by Spell::CheckCast(), Spell::EffectTriggerSpell(), HandleDummyAuraProc(), AuraEffect::HandleModMechanicImmunity(), and spell_gen_remove_impairing_auras::HandleScriptEffect().

◆ RemoveNotOwnSingleTargetAuras()

void Unit::RemoveNotOwnSingleTargetAuras ( )
5097{
5098 // single target auras from other casters
5099 // Iterate m_ownedAuras - aura is marked as single target in Unit::AddAura (and pushed to m_ownedAuras).
5100 // m_appliedAuras will NOT contain the aura before first Unit::Update after adding it to m_ownedAuras.
5101 // Quickly removing such an aura will lead to it not being unregistered from caster's single cast auras container
5102 // leading to assertion failures if the aura was cast on a player that can
5103 // (and is changing map at the point where this function is called).
5104 // Such situation occurs when player is logging in inside an instance and fails the entry check for any reason.
5105 // The aura that was loaded from db (indirectly, via linked casts) gets removed before it has a chance
5106 // to register in m_appliedAuras
5107 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
5108 {
5109 Aura const* aura = iter->second;
5110
5111 if (aura->GetCasterGUID() != GetGUID() && aura->IsSingleTarget())
5112 RemoveOwnedAura(iter);
5113 else
5114 ++iter;
5115 }
5116
5117 // single target auras at other targets
5118 AuraList& scAuras = GetSingleCastAuras();
5119 for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
5120 {
5121 Aura* aura = *iter;
5122 if (aura->GetUnitOwner() != this)
5123 {
5124 aura->Remove();
5125 iter = scAuras.begin();
5126 }
5127 else
5128 ++iter;
5129 }
5130}

References Aura::GetCasterGUID(), Object::GetGUID(), GetSingleCastAuras(), Aura::GetUnitOwner(), Aura::IsSingleTarget(), m_ownedAuras, Aura::Remove(), and RemoveOwnedAura().

Referenced by RemoveFromWorld().

◆ RemoveNpcFlag()

void Unit::RemoveNpcFlag ( NPCFlags  flags)
inline
993{ RemoveFlag(UNIT_NPC_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_NPC_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_vaelastrasz::boss_vaelAI::BeginSpeech(), npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_fos_leader::npc_fos_leaderAI::DoAction(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_akama_illidan::npc_akama_illidanAI::DoAction(), spell_q12096_q12092_dummy::HandleDummy(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), npc_precious::npc_preciousAI::JustEngagedWith(), npc_artorius::npc_artoriusAI::JustEngagedWith(), npc_simone::npc_simoneAI::JustEngagedWith(), npc_nelson::npc_nelsonAI::JustEngagedWith(), npc_franklin::npc_franklinAI::JustEngagedWith(), npc_fos_leader_second::npc_fos_leader_secondAI::npc_fos_leader_secondAI(), npc_pos_leader_second::npc_pos_leader_secondAI::npc_pos_leader_secondAI(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_serpent_shrine::instance_serpentshrine_cavern_InstanceMapScript::OnCreatureCreate(), npc_announcer_toc10::OnGossipHello(), npc_hyjal_jaina::OnGossipSelect(), npc_hyjal_thrall::OnGossipSelect(), boss_doomrel::OnGossipSelect(), boss_majordomo::OnGossipSelect(), npc_zulaman_hostage::OnGossipSelect(), npc_arthas::OnGossipSelect(), npc_ulduar_keeper::OnGossipSelect(), npc_announcer_toc5::OnGossipSelect(), npc_announcer_toc10::OnGossipSelect(), npc_hor_leader::OnGossipSelect(), npc_ulduar_expedition_commander::OnGossipSelect(), npc_thrall_old_hillsbrad::OnGossipSelect(), npc_hor_leader_second::OnGossipSelect(), npc_battle_at_valhalas::OnQuestAccept(), npc_riggle_bassbait::OnQuestReward(), NPCStaveQuestAI::PrepareForEncounter(), RemoveVehicleKit(), boss_majordomo::boss_majordomoAI::Reset(), npc_arthas::npc_arthasAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), npc_xerestrasza::npc_xerestraszaAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_lake_frog::npc_lake_frogAI::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_magister_aledis::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), npc_tirion_fordring_tft::npc_tirion_fordringAI::sGossipSelect(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::sGossipSelect(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::sGossipSelect(), boss_apothecary_hummel::boss_apothecary_hummelAI::sGossipSelect(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_harrison_jones::npc_harrison_jonesAI::sGossipSelect(), npc_thassarian2::npc_thassarian2AI::sGossipSelect(), npc_general_andorov::sGossipSelect(), npc_akama_shade::sGossipSelect(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_chesspiece::SpellHitTarget(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), dragonmaw_race_npc::sQuestAccept(), npc_magister_aledis::StartFight(), npc_cork_gizelton::npc_cork_gizeltonAI::SummonHelpers(), npc_plucky::npc_pluckyAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), and npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI().

◆ RemoveOwnedAura() [1/3]

void Unit::RemoveOwnedAura ( Aura aura,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4701{
4702 if (aura->IsRemoved())
4703 return;
4704
4705 ASSERT(aura->GetOwner() == this);
4706
4707 uint32 spellId = aura->GetId();
4708 AuraMapBoundsNonConst range = m_ownedAuras.equal_range(spellId);
4709
4710 for (AuraMap::iterator itr = range.first; itr != range.second; ++itr)
4711 {
4712 if (itr->second == aura)
4713 {
4714 RemoveOwnedAura(itr, removeMode);
4715 return;
4716 }
4717 }
4718
4719 ABORT();
4720}

References ABORT, ASSERT, Aura::GetId(), Aura::GetOwner(), Aura::IsRemoved(), m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAura() [2/3]

void Unit::RemoveOwnedAura ( AuraMap::iterator &  i,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)

◆ RemoveOwnedAura() [3/3]

void Unit::RemoveOwnedAura ( uint32  spellId,
ObjectGuid  casterGUID = ObjectGuid::Empty,
uint8  reqEffMask = 0,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
4689{
4690 for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);)
4691 if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || itr->second->GetCasterGUID() == casterGUID))
4692 {
4693 RemoveOwnedAura(itr, removeMode);
4694 itr = m_ownedAuras.lower_bound(spellId);
4695 }
4696 else
4697 ++itr;
4698}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [1/2]

void Unit::RemoveOwnedAuras ( std::function< bool(Aura const *)> const &  check)
4820{
4821 for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
4822 {
4823 if (check(iter->second))
4824 {
4825 RemoveOwnedAura(iter);
4826 continue;
4827 }
4828 ++iter;
4829 }
4830}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemoveOwnedAuras() [2/2]

void Unit::RemoveOwnedAuras ( uint32  spellId,
std::function< bool(Aura const *)> const &  check 
)
4846{
4847 for (AuraMap::iterator iter = m_ownedAuras.lower_bound(spellId); iter != m_ownedAuras.upper_bound(spellId);)
4848 {
4849 if (check(iter->second))
4850 {
4851 RemoveOwnedAura(iter);
4852 continue;
4853 }
4854 ++iter;
4855 }
4856}

References m_ownedAuras, and RemoveOwnedAura().

◆ RemovePetAura()

void Unit::RemovePetAura ( PetAura const *  petSpell)
17227{
17228 if (GetTypeId() != TYPEID_PLAYER)
17229 return;
17230
17231 m_petAuras.erase(petSpell);
17232 if (Pet* pet = ToPlayer()->GetPet())
17233 pet->RemoveAurasDueToSpell(petSpell->GetAura(pet->GetEntry()));
17234 if (Unit* charm = GetCharm())
17235 charm->RemoveAurasDueToSpell(petSpell->GetAura(charm->GetEntry()));
17236}

References PetAura::GetAura(), GetCharm(), Object::GetTypeId(), m_petAuras, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Player::_removeTalentAurasAndSpells(), Pet::CastPetAuras(), AuraEffect::HandleAuraDummy(), and Player::removeSpell().

◆ RemovePlayerFromVision()

void Unit::RemovePlayerFromVision ( Player player)
11117{
11118 m_sharedVision.remove(player);
11119 player->m_isInSharedVisionOf.erase(this);
11120 if (m_sharedVision.empty())
11121 {
11122 setActive(false);
11123 SetWorldObject(false);
11124 }
11125}

References Player::m_isInSharedVisionOf, m_sharedVision, WorldObject::setActive(), and WorldObject::SetWorldObject().

Referenced by Player::SetViewpoint(), and Player::~Player().

◆ RemovePointedBy()

void Unit::RemovePointedBy ( SafeUnitPointer sup)
inline

◆ RemoveStandFlags()

void Unit::RemoveStandFlags ( uint8  flags)
inline
@ UNIT_BYTES_1_OFFSET_VIS_FLAG
Definition: UnitDefines.h:25
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag)
Definition: Object.cpp:930

References Object::RemoveByteFlag(), UNIT_BYTES_1_OFFSET_VIS_FLAG, and UNIT_FIELD_BYTES_1.

Referenced by AuraEffect::HandleModStealth(), Player::InitStatsForLevel(), and npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI().

◆ RemoveUnitFlag()

void Unit::RemoveUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

827{ RemoveFlag(UNIT_FIELD_FLAGS, flags); }

References Object::RemoveFlag(), and UNIT_FIELD_FLAGS.

Referenced by spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), Player::BuildPlayerRepop(), boss_thekal::CheckPhaseTransition(), Player::CleanupAfterTaxiFlight(), ClearInCombat(), ClearInPetCombat(), DisableRotate(), boss_thorim::boss_thorimAI::DisableThorim(), Dismount(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_thekal::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_the_lurker_below::DoAction(), npc_frozen_core::DoAction(), boss_broggok::DoAction(), instance_karazhan::instance_karazhan_InstanceMapScript::DoAction(), boss_cthun::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_tyrannus::boss_tyrannusAI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), npc_massive_jormungar::npc_massive_jormungarAI::DoAction(), npc_ferocious_rhino::npc_ferocious_rhinoAI::DoAction(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::DoAction(), npc_frenzied_worgen::npc_frenzied_worgenAI::DoAction(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DoAction(), boss_essence_of_desire::boss_essence_of_desireAI::DoAction(), boss_essence_of_anger::boss_essence_of_angerAI::DoAction(), boss_kelidan_the_breaker::DoAction(), boss_ichoron::boss_ichoronAI::DoExplodeCompleted(), HomeMovementGenerator< Creature >::DoFinalize(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), WorldSession::DoLootRelease(), Spell::EffectResurrectPet(), Spell::EffectSkinning(), npc_giant_claw_tentacle::Emerge(), boss_ahune::Emerge(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_bronjahm::boss_bronjahmAI::EnterEvadeMode(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), boss_kelthuzad::boss_kelthuzadAI::EnterEvadeMode(), boss_malygos::boss_malygosAI::EnterEvadeMode(), boss_ymiron::boss_ymironAI::EnterEvadeMode(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::EnterEvadeMode(), npc_future_you::npc_future_youAI::EnterEvadeMode(), SACActivateEvent::Execute(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::FeignDeath(), TimedFleeingMovementGenerator::Finalize(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_feign_death_all_flags::HandleEffectRemove(), spell_gen_feign_death_no_dyn_flag::HandleEffectRemove(), spell_gen_feign_death_no_prevent_emotes::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), AuraEffect::HandleFeignDeath(), WorldSession::HandleLogoutCancelOpcode(), spell_oculus_drake_flag_aura::HandleOnEffectApply(), spell_oculus_rider_aura::HandleOnEffectRemove(), WorldSession::HandlePlayerLoginToCharInWorld(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_jarien::IsSummonedBy(), boss_sothos::IsSummonedBy(), boss_apothecary_hummel::boss_apothecary_hummelAI::JustDied(), boss_volazj::JustDied(), boss_ichoron::boss_ichoronAI::JustDied(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustDied(), boss_taerar::boss_taerarAI::JustDied(), boss_noth::boss_nothAI::JustDied(), boss_ymiron::boss_ymironAI::JustEngagedWith(), boss_hazzarah::JustSummoned(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), boss_shade_of_akama::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_amanitar_mushrooms::npc_amanitar_mushrooms(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), npc_death_knight_initiate::OnGossipSelect(), npc_bessy::OnQuestAccept(), spell_halion_twilight_phasing_aura::OnRemove(), boss_nightbane::PathEndReached(), boss_nefarian::PathEndReached(), RemoveCharmedBy(), Vehicle::RemovePassenger(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), boss_lord_valthalak::boss_lord_valthalakAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_crone::Reset(), boss_julianne::Reset(), npc_mograine::npc_mograineAI::Reset(), boss_felmyst::boss_felmystAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), boss_muru::boss_muruAI::Reset(), boss_eye_of_cthun::Reset(), boss_volazj::Reset(), boss_anub_arak::boss_anub_arakAI::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_novos::boss_novosAI::Reset(), boss_bronjahm::boss_bronjahmAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_kelthuzad::boss_kelthuzadAI::Reset(), boss_malygos::boss_malygosAI::Reset(), npc_crystalline_frayer::npc_crystalline_frayerAI::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), boss_mimiron::boss_mimironAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_svala::boss_svalaAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), boss_ichoron::boss_ichoronAI::Reset(), npc_wounded_skirmisher::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), boss_leotheras_the_blind::Reset(), npc_shattered_hand_scout::Reset(), emerald_dragonAI::Reset(), npc_doctor::npc_doctorAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Resurrect(), boss_magtheridon::ScheduleCombatEvents(), boss_the_lurker_below::SchedulerPhaseTwo(), SetCharm(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SetData(), npc_ulduar_vx001::npc_ulduar_vx001AI::SetData(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SetData(), Pet::setDeathState(), SetImmuneToNPC(), SetImmuneToPC(), Player::SetIsSpectator(), SetStunned(), SetSwim(), Battlefield::ShowNpc(), boss_zuljin::boss_zuljinAI::SpawnAdds(), npc_black_knight_ghoul::npc_black_knight_ghoulAI::SpellHit(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::SpellHit(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::SpellHit(), npc_ulduar_vx001::npc_ulduar_vx001AI::SpellHit(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::SpellHit(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_headless_horseman_head::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), instance_violet_hold::instance_violet_hold_InstanceMapScript::StartBossEncounter(), boss_lord_valthalak::boss_lord_valthalakAI::StartFighting(), boss_noth::boss_nothAI::StartGroundPhase(), boss_drakkari_colossus::boss_drakkari_colossusAI::SummonedCreatureDespawn(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::UpdateAI(), npc_mograine::npc_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_volazj::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_novos::boss_novosAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_kelthuzad::boss_kelthuzadAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_crystalline_frayer::npc_crystalline_frayerAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), npc_hol_monument::npc_hol_monumentAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_q24545_vegard::npc_q24545_vegardAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), boss_taerar::boss_taerarAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), and npc_general_andorov::WaypointReached().

◆ RemoveUnitFlag2()

◆ RemoveUnitMovementFlag()

◆ RemoveVehicleKit()

void Unit::RemoveVehicleKit ( )
18645{
18646 if (!m_vehicleKit)
18647 return;
18648
18650 delete m_vehicleKit;
18651
18652 m_vehicleKit = nullptr;
18653
18654 m_updateFlag &= ~UPDATEFLAG_VEHICLE;
18655 m_unitTypeMask &= ~UNIT_MASK_VEHICLE;
18657}
@ UNIT_NPC_FLAG_SPELLCLICK
Definition: UnitDefines.h:318
@ UNIT_NPC_FLAG_PLAYER_VEHICLE
Definition: UnitDefines.h:319
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:993

References m_unitTypeMask, Object::m_updateFlag, m_vehicleKit, RemoveNpcFlag(), Vehicle::Uninstall(), UNIT_NPC_FLAG_PLAYER_VEHICLE, and UNIT_NPC_FLAG_SPELLCLICK.

Referenced by Dismount(), AuraEffect::HandleAuraSetVehicle(), npc_gunship::npc_gunshipAI::JustDied(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), spell_blood_queen_frenzied_bloodthirst_aura::OnRemove(), and RemoveFromWorld().

◆ RemoveVisibleAura()

void Unit::RemoveVisibleAura ( uint8  slot)
inline
1503{ m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);}
void UpdateAuraForGroup(uint8 slot)
Definition: Unit.cpp:17097

References m_visibleAuras, and UpdateAuraForGroup().

Referenced by AuraApplication::_Remove().

◆ ReplaceAllDynamicFlags()

◆ ReplaceAllNpcFlags()

void Unit::ReplaceAllNpcFlags ( NPCFlags  flags)
inline

References SetUInt32Value(), and UNIT_NPC_FLAGS.

Referenced by Pet::CreateBaseAtTamed(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), Spell::EffectSummonType(), SmartAI::EndPath(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFlagCommand(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_akama_illidan::npc_akama_illidanAI::JustSummoned(), Pet::LoadPetFromDB(), npc_pet_gen_argent_pony_bridle::OnGossipSelect(), npc_shandy_dalaran::OnGossipSelect(), go_crystalline_tear::OnQuestAccept(), boss_yoggsaron_descend_portal::boss_yoggsaron_descend_portalAI::OnSpellClick(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), boss_doomrel::boss_doomrelAI::Reset(), npc_eris_hevenfire::npc_eris_hevenfireAI::Reset(), npc_taretha::npc_tarethaAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Creature::setDeathState(), npc_eris_hevenfire::npc_eris_hevenfireAI::SetGUID(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_akama_illidan::npc_akama_illidanAI::sGossipSelect(), npc_escortAI::Start(), FollowerAI::StartFollow(), SmartAI::StartPath(), Player::SummonPet(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_lord_arete::npc_lord_areteAI::UpdateAI(), npc_pet_gen_argent_pony_bridle::UpdateAI(), Creature::UpdateEntry(), brann_bronzebeard::brann_bronzebeardAI::UpdateEscortAI(), npc_captain_saeed::npc_captain_saeedAI::WaypointReached(), and npc_akama_illidan::npc_akama_illidanAI::WaypointReached().

◆ ReplaceAllUnitFlags()

◆ ReplaceAllUnitFlags2()

void Unit::ReplaceAllUnitFlags2 ( UnitFlags2  flags)
inline

◆ resetAttackTimer()

◆ ResetRedirectThreat()

◆ RestoreDisplayId()

void Unit::RestoreDisplayId ( )
16704{
16705 AuraEffect* handledAura = nullptr;
16706 AuraEffect* handledAuraForced = nullptr;
16707 // try to receive model from transform auras
16709 if (!transforms.empty())
16710 {
16711 // iterate over already applied transform auras - from newest to oldest
16712 for (auto i = transforms.rbegin(); i != transforms.rend(); ++i)
16713 {
16714 if (AuraApplication const* aurApp = (*i)->GetBase()->GetApplicationOfTarget(GetGUID()))
16715 {
16716 if (!handledAura)
16717 handledAura = (*i);
16718 // xinef: prefer negative/forced auras
16719 if ((*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR0_NO_IMMUNITIES) || !aurApp->IsPositive())
16720 {
16721 handledAuraForced = (*i);
16722 break;
16723 }
16724 }
16725 }
16726 }
16727
16728 // Xinef: include clone auras (eg mirror images)
16729 if (!handledAuraForced && !handledAura)
16730 {
16732 if (!cloneAuras.empty())
16733 for (Unit::AuraEffectList::const_iterator i = cloneAuras.begin(); i != cloneAuras.end(); ++i)
16734 handledAura = *i;
16735 }
16736
16738
16739 // xinef: order of execution is important!
16740 // first forced transform auras, then shapeshifts, then normal transform
16741 // transform aura was found
16742 if (handledAuraForced)
16743 {
16744 handledAuraForced->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
16745 return;
16746 }
16747 else if (!shapeshiftAura.empty()) // we've found shapeshift
16748 {
16749 // only one such aura possible at a time
16750 if (uint32 modelId = GetModelForForm(GetShapeshiftForm(), shapeshiftAura.front()->GetId()))
16751 {
16752 SetDisplayId(modelId);
16753 return;
16754 }
16755 }
16756 else if (handledAura)
16757 {
16758 handledAura->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
16759 return;
16760 }
16761
16762 // no auras found - set modelid to default
16764}
@ SPELL_AURA_MOD_SHAPESHIFT
Definition: SpellAuraDefines.h:99
@ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT
Definition: SpellAuraDefines.h:43
uint32 GetModelForForm(ShapeshiftForm form, uint32 spellId) const
Definition: Unit.cpp:19117
void HandleEffect(AuraApplication *aurApp, uint8 mode, bool apply)
Definition: SpellAuraEffects.cpp:741

References AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, Aura::GetApplicationOfTarget(), GetAuraEffectsByType(), AuraApplication::GetBase(), Object::GetGUID(), GetModelForForm(), GetNativeDisplayId(), GetShapeshiftForm(), AuraEffect::HandleEffect(), SetDisplayId(), SPELL_ATTR0_NO_IMMUNITIES, SPELL_AURA_CLONE_CASTER, SPELL_AURA_MOD_SHAPESHIFT, and SPELL_AURA_TRANSFORM.

Referenced by AuraEffect::HandleAuraModShapeshift(), AuraEffect::HandleAuraTransform(), spell_gen_aura_service_uniform::OnRemove(), and Player::SetIsSpectator().

◆ RestoreFaction()

void Unit::RestoreFaction ( )
18613{
18614 if (IsPlayer())
18616 else
18617 {
18619 {
18620 if (Unit* owner = GetOwner())
18621 {
18622 SetFaction(owner->GetFaction());
18623 return;
18624 }
18625 }
18626
18627 if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
18628 SetFaction(cinfo->faction);
18629 }
18630}
void SetFactionForRace(uint8 race)
Definition: Player.cpp:5805

References GetOwner(), getRace(), HasUnitTypeMask(), Object::IsPlayer(), SetFaction(), Player::SetFactionForRace(), Object::ToCreature(), Object::ToPlayer(), and UNIT_MASK_MINION.

Referenced by npc_magister_aledis::DamageTaken(), npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::DamageTaken(), npc_death_knight_initiate::npc_death_knight_initiateAI::DamageTaken(), boss_thekal::DoAction(), AuraEffect::HandleAuraModFaction(), npc_commandscript::HandleNpcSetOriginalFaction(), npc_enslaved_netherwing_drake::JustDied(), npc_escortAI::JustRespawned(), SmartAI::JustRespawned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), RemoveCharmedBy(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_crusade_persuaded::npc_crusade_persuadedAI::Reset(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_ahnqiraji_critter::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_magister_aledis::Reset(), npc_captain_saeed::npc_captain_saeedAI::Reset(), npc_bessy::npc_bessyAI::Reset(), and npc_enslaved_netherwing_drake::Reset().

◆ ResumeMovement()

void Unit::ResumeMovement ( uint32  timer = 0,
uint8  slot = 0 
)
16609{
16610 if (slot >= MAX_MOTION_SLOT)
16611 return;
16612
16613 if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(slot))
16614 movementGenerator->Resume(timer);
16615}

References GetMotionMaster(), and MAX_MOTION_SLOT.

Referenced by boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight().

◆ RewardRage()

void Unit::RewardRage ( uint32  damage,
uint32  weaponSpeedHitFactor,
bool  attacker 
)
20056{
20057 float addRage;
20058
20059 float rageconversion = ((0.0091107836f * GetLevel() * GetLevel()) + 3.225598133f * GetLevel()) + 4.2652911f;
20060
20061 // Unknown if correct, but lineary adjust rage conversion above level 70
20062 if (GetLevel() > 70)
20063 rageconversion += 13.27f * (GetLevel() - 70);
20064
20065 if (attacker)
20066 {
20067 addRage = (damage / rageconversion * 7.5f + weaponSpeedHitFactor) / 2;
20068
20069 // talent who gave more rage on attack
20071 }
20072 else
20073 {
20074 addRage = damage / rageconversion * 2.5f;
20075
20076 // Berserker Rage effect
20077 if (HasAura(18499))
20078 addRage *= 3.0f;
20079 }
20080
20081 addRage *= sWorld->getRate(RATE_POWER_RAGE_INCOME);
20082
20083 ModifyPower(POWER_RAGE, uint32(addRage * 10));
20084}
@ SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT
Definition: SpellAuraDefines.h:276
@ RATE_POWER_RAGE_INCOME
Definition: IWorld.h:433

References AddPct(), GetLevel(), GetTotalAuraModifier(), HasAura(), ModifyPower(), POWER_RAGE, RATE_POWER_RAGE_INCOME, SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT, and sWorld.

Referenced by DealDamage().

◆ RollMeleeOutcomeAgainst() [1/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType 
) const
2749{
2750 // This is only wrapper
2751
2752 // Miss chance based on melee
2753 //float miss_chance = MeleeMissChanceCalc(victim, attType);
2754 float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(victim->GetMaxSkillValueForLevel(this)), 0);
2755
2756 // Critical hit chance
2757 float crit_chance = GetUnitCriticalChance(attType, victim);
2758 if( crit_chance < 0 )
2759 crit_chance = 0;
2760
2761 float dodge_chance = victim->GetUnitDodgeChance();
2762 float block_chance = victim->GetUnitBlockChance();
2763 float parry_chance = victim->GetUnitParryChance();
2764
2765 // Useful if want to specify crit & miss chances for melee, else it could be removed
2766 //LOG_DEBUG("entities.unit", "MELEE OUTCOME: miss {} crit {} dodge {} parry {} block {}", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance);
2767
2768 return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100));
2769}
float GetUnitCriticalChance(WeaponAttackType attackType, Unit const *victim) const
Definition: Unit.cpp:3695

References GetMaxSkillValueForLevel(), GetUnitBlockChance(), GetUnitCriticalChance(), GetUnitDodgeChance(), GetUnitParryChance(), GetWeaponSkillValue(), MeleeSpellMissChance(), and RollMeleeOutcomeAgainst().

Referenced by CalculateMeleeDamage(), and RollMeleeOutcomeAgainst().

◆ RollMeleeOutcomeAgainst() [2/2]

MeleeHitOutcome Unit::RollMeleeOutcomeAgainst ( Unit const *  victim,
WeaponAttackType  attType,
int32  crit_chance,
int32  miss_chance,
int32  dodge_chance,
int32  parry_chance,
int32  block_chance 
) const
2772{
2773 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks())
2774 {
2775 return MELEE_HIT_EVADE;
2776 }
2777
2778 int32 attackerMaxSkillValueForLevel = GetMaxSkillValueForLevel(victim);
2779 int32 victimMaxSkillValueForLevel = victim->GetMaxSkillValueForLevel(this);
2780
2781 int32 attackerWeaponSkill = GetWeaponSkillValue(attType, victim);
2782 int32 victimDefenseSkill = victim->GetDefenseSkillValue(this);
2783
2784 sScriptMgr->OnBeforeRollMeleeOutcomeAgainst(this, victim, attType, attackerMaxSkillValueForLevel, victimMaxSkillValueForLevel, attackerWeaponSkill, victimDefenseSkill, crit_chance, miss_chance, dodge_chance, parry_chance, block_chance);
2785
2786 // bonus from skills is 0.04%
2787 int32 skillBonus = 4 * (attackerWeaponSkill - victimMaxSkillValueForLevel);
2788 int32 sum = 0, tmp = 0;
2789 int32 roll = urand (0, 10000);
2790
2791 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: skill bonus of {} for attacker", skillBonus);
2792 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: rolled {}, miss {}, dodge {}, parry {}, block {}, crit {}",
2793 // roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance);
2794
2795 tmp = miss_chance;
2796
2797 if (tmp > 0 && roll < (sum += tmp))
2798 {
2799 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: MISS");
2800 return MELEE_HIT_MISS;
2801 }
2802
2803 // Dodge chance
2804
2805 // only players can't dodge if attacker is behind
2806 if (victim->IsPlayer() && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
2807 {
2808 //LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player.");
2809 }
2810 // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag
2811 else if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE))
2812 {
2813 // Reduce dodge chance by attacker expertise rating
2814 if (IsPlayer())
2815 dodge_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2816 else
2817 dodge_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2818
2819 // Modify dodge chance by attacker SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
2821 dodge_chance = int32 (float (dodge_chance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
2822
2823 tmp = dodge_chance;
2824
2825 // xinef: if casting or stunned - cant dodge
2826 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2827 tmp = 0;
2828
2829 if ((tmp > 0) // check if unit _can_ dodge
2830 && ((tmp -= skillBonus) > 0)
2831 && roll < (sum += tmp))
2832 {
2833 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: DODGE <{}, {})", sum - tmp, sum);
2834 return MELEE_HIT_DODGE;
2835 }
2836 }
2837
2838 // parry & block chances
2839
2840 // check if attack comes from behind, nobody can parry or block if attacker is behind
2841 if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION))
2842 {
2843 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: attack came from behind.");
2844 }
2845 else
2846 {
2847 // Reduce parry chance by attacker expertise rating
2848 if (IsPlayer())
2849 parry_chance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100);
2850 else
2851 parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
2852
2853 if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
2854 {
2855 tmp = parry_chance;
2856
2857 // xinef: cant parry while casting or while stunned
2858 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2859 tmp = 0;
2860
2861 if (tmp > 0 // check if unit _can_ parry
2862 && (tmp -= skillBonus) > 0
2863 && roll < (sum += tmp))
2864 {
2865 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: PARRY <{}, {})", sum - tmp, sum);
2866 return MELEE_HIT_PARRY;
2867 }
2868 }
2869
2870 if (victim->IsPlayer() || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
2871 {
2872 tmp = block_chance;
2873
2874 // xinef: cant block while casting or while stunned
2875 if (victim->IsNonMeleeSpellCast(false, false, true) || victim->HasUnitState(UNIT_STATE_CONTROLLED))
2876 tmp = 0;
2877
2878 if (tmp > 0 // check if unit _can_ block
2879 && (tmp -= skillBonus) > 0
2880 && roll < (sum += tmp))
2881 {
2882 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: BLOCK <{}, {})", sum - tmp, sum);
2883 return MELEE_HIT_BLOCK;
2884 }
2885 }
2886 }
2887
2888 // Max 40% chance to score a glancing blow against mobs that are higher level (can do only players and pets and not with ranged weapon)
2889 if (attType != RANGED_ATTACK &&
2890 (IsPlayer() || IsPet()) &&
2891 victim->GetTypeId() != TYPEID_PLAYER && !victim->IsPet() &&
2892 GetLevel() < victim->getLevelForTarget(this))
2893 {
2894 // cap possible value (with bonuses > max skill)
2895 int32 skill = attackerWeaponSkill;
2896 int32 maxskill = attackerMaxSkillValueForLevel;
2897 skill = (skill > maxskill) ? maxskill : skill;
2898
2899 tmp = (10 + (victimDefenseSkill - skill)) * 100;
2900 tmp = tmp > 4000 ? 4000 : tmp;
2901 if (roll < (sum += tmp))
2902 {
2903 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: GLANCING <{}, {})", sum - 4000, sum);
2904 return MELEE_HIT_GLANCING;
2905 }
2906 }
2907
2908 // mobs can score crushing blows if they're 4 or more levels above victim
2909 if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
2910 // can be from by creature (if can) or from controlled player that considered as creature
2912 !(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS))
2913 {
2914 // when their weapon skill is 15 or more above victim's defense skill
2915 tmp = victimDefenseSkill;
2916 int32 tmpmax = victimMaxSkillValueForLevel;
2917 // having defense above your maximum (from items, talents etc.) has no effect
2918 tmp = tmp > tmpmax ? tmpmax : tmp;
2919 // tmp = mob's level * 5 - player's current defense skill
2920 tmp = attackerMaxSkillValueForLevel - tmp;
2921 if (tmp >= 15)
2922 {
2923 // add 2% chance per lacking skill point, min. is 15%
2924 tmp = tmp * 200 - 1500;
2925 if (roll < (sum += tmp))
2926 {
2927 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRUSHING <{}, {})", sum - tmp, sum);
2928 return MELEE_HIT_CRUSHING;
2929 }
2930 }
2931 }
2932
2933 // Critical chance
2934 tmp = crit_chance;
2935
2936 if (tmp > 0 && roll < (sum += tmp))
2937 {
2938 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT <{}, {})", sum - tmp, sum);
2939 if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
2940 {
2941 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: CRIT DISABLED)");
2942 }
2943 else
2944 return MELEE_HIT_CRIT;
2945 }
2946
2947 LOG_DEBUG("entities.unit", "RollMeleeOutcomeAgainst: NORMAL");
2948 return MELEE_HIT_NORMAL;
2949}
@ CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS
Definition: CreatureData.h:51
@ CREATURE_FLAG_EXTRA_NO_CRIT
Definition: CreatureData.h:63

References CREATURE_FLAG_EXTRA_NO_BLOCK, CREATURE_FLAG_EXTRA_NO_CRIT, CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS, CREATURE_FLAG_EXTRA_NO_DODGE, CREATURE_FLAG_EXTRA_NO_PARRY, CreatureTemplate::flags_extra, Creature::GetCreatureTemplate(), GetDefenseSkillValue(), GetLevel(), getLevelForTarget(), GetMaxSkillValueForLevel(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscValue(), GetTotalAuraMultiplier(), Object::GetTypeId(), GetWeaponSkillValue(), HasAuraType(), Position::HasInArc(), HasUnitState(), IsControlledByPlayer(), Creature::IsEvadingAttacks(), IsNonMeleeSpellCast(), IsPet(), Object::IsPlayer(), LOG_DEBUG, MELEE_HIT_BLOCK, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_DODGE, MELEE_HIT_EVADE, MELEE_HIT_GLANCING, MELEE_HIT_MISS, MELEE_HIT_NORMAL, MELEE_HIT_PARRY, RANGED_ATTACK, SPELL_AURA_IGNORE_HIT_DIRECTION, SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, SPELL_AURA_MOD_ENEMY_DODGE, SPELL_AURA_MOD_EXPERTISE, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_STATE_CONTROLLED, urand(), and VICTIMSTATE_DODGE.

◆ Say() [1/2]

◆ Say() [2/2]

void Unit::Say ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

21085{
21086 Talk(textId, CHAT_MSG_MONSTER_SAY, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), target);
21087}

References CHAT_MSG_MONSTER_SAY, CONFIG_LISTEN_RANGE_SAY, and sWorld.

◆ SelectNearbyNoTotemTarget()

Unit * Unit::SelectNearbyNoTotemTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
16948{
16949 std::list<Unit*> targets;
16950 Acore::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, this, dist);
16952 Cell::VisitAllObjects(this, searcher, dist);
16953
16954 // remove current target
16955 if (GetVictim())
16956 targets.remove(GetVictim());
16957
16958 if (exclude)
16959 targets.remove(exclude);
16960
16961 // remove not LoS targets
16962 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
16963 {
16964 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
16965 {
16966 std::list<Unit*>::iterator tIter2 = tIter;
16967 ++tIter;
16968 targets.erase(tIter2);
16969 }
16970 else
16971 ++tIter;
16972 }
16973
16974 // no appropriate targets
16975 if (targets.empty())
16976 return nullptr;
16977
16978 // select random
16980}
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition: Containers.h:133
bool IsValidAttackTarget(Unit const *target, SpellInfo const *bySpell=nullptr) const
Definition: Unit.cpp:13800
Definition: GridNotifiers.h:423

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitAllObjects().

Referenced by spell_rog_blade_flurry::CheckProc(), and spell_warr_sweeping_strikes::CheckProc().

◆ SelectNearbyTarget()

Unit * Unit::SelectNearbyTarget ( Unit exclude = nullptr,
float  dist = NOMINAL_MELEE_RANGE 
) const
16913{
16914 std::list<Unit*> targets;
16915 Acore::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, this, dist);
16917 Cell::VisitAllObjects(this, searcher, dist);
16918
16919 // remove current target
16920 if (GetVictim())
16921 targets.remove(GetVictim());
16922
16923 if (exclude)
16924 targets.remove(exclude);
16925
16926 // remove not LoS targets
16927 for (std::list<Unit*>::iterator tIter = targets.begin(); tIter != targets.end();)
16928 {
16929 if (!IsWithinLOSInMap(*tIter) || !IsValidAttackTarget(*tIter))
16930 {
16931 std::list<Unit*>::iterator tIter2 = tIter;
16932 ++tIter;
16933 targets.erase(tIter2);
16934 }
16935 else
16936 ++tIter;
16937 }
16938
16939 // no appropriate targets
16940 if (targets.empty())
16941 return nullptr;
16942
16943 // select random
16945}
Definition: GridNotifiers.h:861

References GetVictim(), IsValidAttackTarget(), WorldObject::IsWithinLOSInMap(), Acore::Containers::SelectRandomContainerElement(), and Cell::VisitAllObjects().

Referenced by npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_curator::JustSummoned(), npc_hodirs_fury::npc_hodirs_furyAI::UpdateAI(), npc_storm_beacon_spawn::npc_storm_beacon_spawnAI::UpdateAI(), boss_kologarn::boss_kologarnAI::UpdateAI(), boss_thorim_trap::boss_thorim_trapAI::UpdateAI(), npc_llod_generic::npc_llod_genericAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), Player::UpdateCharmedAI(), and boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::UpdateEscortAI().

◆ SendAttackStateUpdate() [1/2]

void Unit::SendAttackStateUpdate ( CalcDamageInfo damageInfo)

Probably used for debugging purposes, as it is not known to appear on retail servers

6431{
6432 LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE");
6433
6434 uint32 tmpDamage[MAX_ITEM_PROTO_DAMAGES] = { };
6435 uint32 tmpAbsorb[MAX_ITEM_PROTO_DAMAGES] = { };
6436 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
6437 {
6438 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6439 tmpDamage[i] = damageInfo->damages[i].damage;
6440 tmpAbsorb[i] = damageInfo->damages[i].absorb;
6441 if (damageInfo->target->IsPlayer() && damageInfo->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6442 {
6443 tmpAbsorb[i] = tmpDamage[i];
6444 tmpDamage[i] = 0;
6445 }
6446 }
6447
6448 uint32 count = 1;
6449 if (tmpDamage[1] || tmpAbsorb[1] || damageInfo->damages[1].resist)
6450 {
6451 ++count;
6452 }
6453
6454 std::size_t const maxsize = 4 + 5 + 5 + 4 + 4 + 1 + count * (4 + 4 + 4 + 4 + 4) + 1 + 4 + 4 + 4 + 4 + 4 * 12;
6455 WorldPacket data(SMSG_ATTACKERSTATEUPDATE, maxsize); // we guess size
6456 data << uint32(damageInfo->HitInfo);
6457 data << damageInfo->attacker->GetPackGUID();
6458 data << damageInfo->target->GetPackGUID();
6459 data << uint32(tmpDamage[0] + tmpDamage[1]); // Full damage
6460 int32 overkill = tmpDamage[0] + tmpDamage[1] - damageInfo->target->GetHealth();
6461 data << uint32(overkill < 0 ? 0 : overkill); // Overkill
6462 data << uint8(count); // Sub damage count
6463
6464 for (uint32 i = 0; i < count; ++i)
6465 {
6466 data << uint32(damageInfo->damages[i].damageSchoolMask); // School of sub damage
6467 data << float(tmpDamage[i]); // sub damage
6468 data << uint32(tmpDamage[i]); // Sub Damage
6469 }
6470
6472 {
6473 for (uint32 i = 0; i < count; ++i)
6474 {
6475 data << uint32(tmpAbsorb[i]); // Absorb
6476 }
6477 }
6478
6480 {
6481 for (uint32 i = 0; i < count; ++i)
6482 {
6483 data << uint32(damageInfo->damages[i].resist); // Resist
6484 }
6485 }
6486
6487 data << uint8(damageInfo->TargetState);
6488 data << uint32(0); // Unknown attackerstate
6489 data << uint32(0); // Melee spellid
6490
6491 if (damageInfo->HitInfo & HITINFO_BLOCK)
6492 data << uint32(damageInfo->blocked_amount);
6493
6494 if (damageInfo->HitInfo & HITINFO_RAGE_GAIN)
6495 data << uint32(0);
6496
6498 if (damageInfo->HitInfo & HITINFO_UNK1)
6499 {
6500 data << uint32(0);
6501 data << float(0);
6502 data << float(0);
6503 data << float(0);
6504 data << float(0);
6505 data << float(0);
6506 data << float(0);
6507 data << float(0);
6508 data << float(0);
6509 data << float(0); // Found in a loop with 1 iteration
6510 data << float(0); // ditto ^
6511 data << uint32(0);
6512 }
6513
6514 SendMessageToSet(&data, true);
6515}
@ HITINFO_RAGE_GAIN
Definition: Unit.h:120
@ HITINFO_UNK1
Definition: Unit.h:97
@ SMSG_ATTACKERSTATEUPDATE
Definition: Opcodes.h:360

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CHEAT_GOD, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), CalcDamageInfo::HitInfo, HITINFO_BLOCK, HITINFO_FULL_ABSORB, HITINFO_FULL_RESIST, HITINFO_PARTIAL_ABSORB, HITINFO_PARTIAL_RESIST, HITINFO_RAGE_GAIN, HITINFO_UNK1, Object::IsPlayer(), LOG_DEBUG, MAX_ITEM_PROTO_DAMAGES, CalcDamageInfo::resist, WorldObject::SendMessageToSet(), SMSG_ATTACKERSTATEUPDATE, CalcDamageInfo::target, CalcDamageInfo::TargetState, and Object::ToPlayer().

Referenced by AttackerStateUpdate(), misc_commandscript::HandleDamageCommand(), spell_dk_dancing_rune_weapon::HandleProc(), and SendAttackStateUpdate().

◆ SendAttackStateUpdate() [2/2]

void Unit::SendAttackStateUpdate ( uint32  HitInfo,
Unit target,
uint8  SwingType,
SpellSchoolMask  damageSchoolMask,
uint32  Damage,
uint32  AbsorbDamage,
uint32  Resist,
VictimState  TargetState,
uint32  BlockedAmount 
)
6518{
6519 CalcDamageInfo dmgInfo;
6520 dmgInfo.HitInfo = HitInfo;
6521 dmgInfo.attacker = this;
6522 dmgInfo.target = target;
6523
6524 dmgInfo.damages[0].damage = Damage - AbsorbDamage - Resist - BlockedAmount;
6525 dmgInfo.damages[0].damageSchoolMask = damageSchoolMask;
6526 dmgInfo.damages[0].absorb = AbsorbDamage;
6527 dmgInfo.damages[0].resist = Resist;
6528
6529 dmgInfo.damages[1].damage = 0;
6530 dmgInfo.damages[1].damageSchoolMask = 0;
6531 dmgInfo.damages[1].absorb = 0;
6532 dmgInfo.damages[1].resist = 0;
6533
6534 dmgInfo.TargetState = TargetState;
6535 dmgInfo.blocked_amount = BlockedAmount;
6536 SendAttackStateUpdate(&dmgInfo);
6537}
HitInfo
Definition: Unit.h:95

References CalcDamageInfo::absorb, CalcDamageInfo::attacker, CalcDamageInfo::blocked_amount, CalcDamageInfo::damage, CalcDamageInfo::damages, CalcDamageInfo::damageSchoolMask, CalcDamageInfo::HitInfo, CalcDamageInfo::resist, SendAttackStateUpdate(), CalcDamageInfo::target, and CalcDamageInfo::TargetState.

◆ SendChangeCurrentVictimOpcode()

void Unit::SendChangeCurrentVictimOpcode ( HostileReference pHostileReference)
20018{
20019 if (!GetThreatMgr().isThreatListEmpty())
20020 {
20021 uint32 count = GetThreatMgr().GetThreatList().size();
20022
20023 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
20024 WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
20025 data << GetPackGUID();
20026 data << pHostileReference->getUnitGuid().WriteAsPacked();
20027 data << uint32(count);
20029 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
20030 {
20031 data << (*itr)->getUnitGuid().WriteAsPacked();
20032 data << uint32((*itr)->GetThreat() * 100);
20033 }
20034 SendMessageToSet(&data, false);
20035 }
20036}
@ SMSG_HIGHEST_THREAT_UPDATE
Definition: Opcodes.h:1184
std::list< HostileReference * > StorageType
Definition: ThreatMgr.h:148
PackedGuid WriteAsPacked() const
Definition: ObjectGuid.h:316

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_HIGHEST_THREAT_UPDATE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::setCurrentVictim().

◆ SendClearTarget()

void Unit::SendClearTarget ( )
20230{
20232 data << GetPackGUID();
20233 SendMessageToSet(&data, false);
20234}
@ SMSG_BREAK_TARGET
Definition: Opcodes.h:368

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_BREAK_TARGET.

Referenced by Vehicle::AddPassenger(), and Spell::EffectForceDeselect().

◆ SendClearThreatListOpcode()

void Unit::SendClearThreatListOpcode ( )
20039{
20040 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message");
20042 data << GetPackGUID();
20043 SendMessageToSet(&data, false);
20044}
@ SMSG_THREAT_CLEAR
Definition: Opcodes.h:1187

References Object::GetPackGUID(), LOG_DEBUG, WorldObject::SendMessageToSet(), and SMSG_THREAT_CLEAR.

Referenced by ThreatMgr::ClearAllThreat().

◆ SendComboPoints()

void Unit::SendComboPoints ( )
16810{
16811 if (m_cleanupDone)
16812 {
16813 return;
16814 }
16815
16817 if (Player* playerMe = ToPlayer())
16818 {
16819 WorldPacket data(SMSG_UPDATE_COMBO_POINTS, packGUID.size() + 1);
16820 data << packGUID;
16821 data << uint8(m_comboPoints);
16822 playerMe->SendDirectMessage(&data);
16823 }
16824
16825 ObjectGuid ownerGuid = GetCharmerOrOwnerGUID();
16826 Player* owner = nullptr;
16827 if (ownerGuid.IsPlayer())
16828 {
16829 owner = ObjectAccessor::GetPlayer(*this, ownerGuid);
16830 }
16831
16832 if (m_movedByPlayer || owner)
16833 {
16834 WorldPacket data(SMSG_PET_UPDATE_COMBO_POINTS, GetPackGUID().size() + packGUID.size() + 1);
16835 data << GetPackGUID();
16836 data << packGUID;
16837 data << uint8(m_comboPoints);
16838
16839 if (m_movedByPlayer)
16841
16842 if (owner && owner != m_movedByPlayer)
16843 owner->SendDirectMessage(&data);
16844 }
16845}
@ SMSG_PET_UPDATE_COMBO_POINTS
Definition: Opcodes.h:1200
@ SMSG_UPDATE_COMBO_POINTS
Definition: Opcodes.h:955
Definition: ObjectGuid.h:263
std::size_t size() const
Definition: ObjectGuid.h:274

References GetCharmerOrOwnerGUID(), Object::GetPackGUID(), ObjectAccessor::GetPlayer(), ObjectGuid::IsPlayer(), m_cleanupDone, m_comboPoints, m_comboTarget, m_movedByPlayer, Player::SendDirectMessage(), PackedGuid::size(), SMSG_PET_UPDATE_COMBO_POINTS, SMSG_UPDATE_COMBO_POINTS, and Object::ToPlayer().

Referenced by AddComboPoints(), and ClearComboPoints().

◆ SendEnergizeSpellLog()

void Unit::SendEnergizeSpellLog ( Unit victim,
uint32  SpellID,
uint32  Damage,
Powers  powertype 
)
11196{
11197 WorldPacket data(SMSG_SPELLENERGIZELOG, (8 + 8 + 4 + 4 + 4 + 1));
11198 data << victim->GetPackGUID();
11199 data << GetPackGUID();
11200 data << uint32(spellID);
11201 data << uint32(powerType);
11202 data << uint32(damage);
11203 SendMessageToSet(&data, true);
11204}
@ SMSG_SPELLENERGIZELOG
Definition: Opcodes.h:367

References Object::GetPackGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLENERGIZELOG.

Referenced by EnergizeBySpell(), and AuraEffect::HandlePeriodicTriggerSpellAuraTick().

◆ SendHealSpellLog()

void Unit::SendHealSpellLog ( HealInfo const &  healInfo,
bool  critical = false 
)
11163{
11164 uint32 overheal = healInfo.GetHeal() - healInfo.GetEffectiveHeal();
11165
11166 // we guess size
11167 WorldPacket data(SMSG_SPELLHEALLOG, (8 + 8 + 4 + 4 + 4 + 4 + 1 + 1));
11168 data << healInfo.GetTarget()->GetPackGUID();
11169 data << GetPackGUID();
11170 data << uint32(healInfo.GetSpellInfo()->Id);
11171 data << uint32(healInfo.GetHeal());
11172 data << uint32(overheal);
11173 data << uint32(healInfo.GetAbsorb()); // Absorb amount
11174 data << uint8(critical ? 1 : 0);
11175 data << uint8(0); // unused
11176 SendMessageToSet(&data, true);
11177}
@ SMSG_SPELLHEALLOG
Definition: Opcodes.h:366

References HealInfo::GetAbsorb(), HealInfo::GetEffectiveHeal(), HealInfo::GetHeal(), Object::GetPackGUID(), HealInfo::GetSpellInfo(), HealInfo::GetTarget(), SpellInfo::Id, WorldObject::SendMessageToSet(), and SMSG_SPELLHEALLOG.

Referenced by HealBySpell().

◆ SendMeleeAttackStart()

void Unit::SendMeleeAttackStart ( Unit victim,
Player sendTo = nullptr 
)
3029{
3030 WorldPacket data(SMSG_ATTACKSTART, 8 + 8);
3031 data << GetGUID();
3032 data << victim->GetGUID();
3033 if (sendTo)
3034 sendTo->SendDirectMessage(&data);
3035 else
3036 SendMessageToSet(&data, true);
3037 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTART");
3038}
@ SMSG_ATTACKSTART
Definition: Opcodes.h:353

References Object::GetGUID(), LOG_DEBUG, Player::SendDirectMessage(), WorldObject::SendMessageToSet(), and SMSG_ATTACKSTART.

Referenced by Attack(), Player::GetInitialVisiblePackets(), and boss_leotheras_the_blind::Reset().

◆ SendMeleeAttackStop()

void Unit::SendMeleeAttackStop ( Unit victim = nullptr)

Send to the client SMSG_ATTACKSTOP but doesn't clear UNIT_STATE_MELEE_ATTACKING on server side or interrupt spells. Unless you know exactly what you're doing, use AttackStop() or RemoveAllAttackers() instead.

3045{
3046 // pussywizard: calling SendMeleeAttackStop without clearing UNIT_STATE_MELEE_ATTACKING and then AttackStart the same player may spoil npc rotating!
3047 // pussywizard: this happens in some boss scripts, just add clearing here
3048 // ClearUnitState(UNIT_STATE_MELEE_ATTACKING); // commented out for now
3049
3050 WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4));
3051 data << GetPackGUID();
3052
3053 if (victim)
3054 {
3055 data << victim->GetPackGUID();
3056 data << (uint32)victim->isDead();
3057 }
3058 SendMessageToSet(&data, true);
3059 LOG_DEBUG("entities.unit", "WORLD: Sent SMSG_ATTACKSTOP");
3060
3061 if (victim)
3062 LOG_DEBUG("entities.unit", "{} {} stopped attacking {} {}", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString(), (victim->IsPlayer() ? "player" : "creature"), victim->GetGUID().ToString());
3063 else
3064 LOG_DEBUG("entities.unit", "{} {} stopped attacking", (IsPlayer() ? "Player" : "Creature"), GetGUID().ToString());
3065}
@ SMSG_ATTACKSTOP
Definition: Opcodes.h:354
bool isDead() const
Definition: Unit.h:1153

References Object::GetGUID(), Object::GetPackGUID(), isDead(), Object::IsPlayer(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_ATTACKSTOP, ObjectGuid::ToString(), and Position::ToString().

Referenced by Attack(), AttackStop(), boss_garfrost::boss_garfrostAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), spell_svalna_revive_champion::Land(), boss_leotheras_the_blind::Reset(), SetControlled(), boss_razorscale::boss_razorscaleAI::SpellHit(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), and boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI().

◆ SendMonsterMove()

void Unit::SendMonsterMove ( float  NewPosX,
float  NewPosY,
float  NewPosZ,
uint32  TransitTime,
SplineFlags  sf = SPLINEFLAG_WALK_MODE 
)
539{
540 WorldPacket data(SMSG_MONSTER_MOVE, 1 + 12 + 4 + 1 + 4 + 4 + 4 + 12 + GetPackGUID().size());
541 data << GetPackGUID();
542
543 data << uint8(0); // new in 3.1
544 data << GetPositionX() << GetPositionY() << GetPositionZ();
545 data << GameTime::GetGameTimeMS().count();
546 data << uint8(0);
547 data << uint32(sf);
548 data << TransitTime; // Time in between points
549 data << uint32(1); // 1 single waypoint
550 data << NewPosX << NewPosY << NewPosZ; // the single waypoint Point B
551
552 SendMessageToSet(&data, true);
553}
@ SMSG_MONSTER_MOVE
Definition: Opcodes.h:251

References GameTime::GetGameTimeMS(), Object::GetPackGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::SendMessageToSet(), and SMSG_MONSTER_MOVE.

Referenced by npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI().

◆ SendMovementFeatherFall()

void Unit::SendMovementFeatherFall ( Player sendTo)
20568{
20569 if (!movespline->Initialized())
20570 return;
20572 data << GetPackGUID();
20573 sendTo->SendDirectMessage(&data);
20574}
@ SMSG_SPLINE_MOVE_FEATHER_FALL
Definition: Opcodes.h:803

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_FEATHER_FALL.

Referenced by Player::GetAurasForTarget().

◆ SendMovementFlagUpdate()

void Unit::SendMovementFlagUpdate ( bool  self = false)
16633{
16634 WorldPacket data;
16635 BuildHeartBeatMsg(&data);
16636 SendMessageToSet(&data, self);
16637}
void BuildHeartBeatMsg(WorldPacket *data) const
Definition: Object.cpp:2073

References BuildHeartBeatMsg(), and WorldObject::SendMessageToSet().

Referenced by boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), npc_ball_of_flame::npc_ball_of_flameAI::DoAction(), boss_nightbane::EnterEvadeMode(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_harbinger_skyriss::JustSummoned(), MotionMaster::MoveFall(), npc_twilight_volunteer::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), npc_eoe_wyrmrest_skytalon::npc_eoe_wyrmrest_skytalonAI::PassengerBoarded(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), npc_dancing_flames::npc_dancing_flamesAI::Reset(), SetCharm(), SetHover(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_nightbane::TriggerHealthTakeOff(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_valkyr_shadowguard::npc_valkyr_shadowguardAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), boss_koralon::boss_koralonAI::UpdateAI(), and Player::UpdateCharmedAI().

◆ SendMovementHover()

void Unit::SendMovementHover ( Player sendTo)
20605{
20606 if (!movespline->Initialized())
20607 return;
20609 data << GetPackGUID();
20610 sendTo->SendDirectMessage(&data);
20611}
@ SMSG_SPLINE_MOVE_SET_HOVER
Definition: Opcodes.h:805

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_SET_HOVER.

Referenced by Player::GetAurasForTarget().

◆ SendMovementWaterWalking()

void Unit::SendMovementWaterWalking ( Player sendTo)
20546{
20547 if (!movespline->Initialized())
20548 return;
20550 data << GetPackGUID();
20551 sendTo->SendDirectMessage(&data);
20552}
@ SMSG_SPLINE_MOVE_WATER_WALK
Definition: Opcodes.h:807

References Object::GetPackGUID(), Movement::MoveSpline::Initialized(), movespline, Player::SendDirectMessage(), and SMSG_SPLINE_MOVE_WATER_WALK.

Referenced by Player::GetAurasForTarget().

◆ SendPeriodicAuraLog()

void Unit::SendPeriodicAuraLog ( SpellPeriodicAuraLogInfo pInfo)
6341{
6342 AuraEffect const* aura = pInfo->auraEff;
6344 data << GetPackGUID();
6345 data << aura->GetCasterGUID().WriteAsPacked();
6346 data << uint32(aura->GetId()); // spellId
6347 data << uint32(1); // count
6348 data << uint32(aura->GetAuraType()); // auraId
6349 switch (aura->GetAuraType())
6350 {
6353 {
6354 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6355 uint32 damage = pInfo->damage;
6356 uint32 absorb = pInfo->absorb;
6357 if (IsPlayer() && ToPlayer()->GetCommandStatus(CHEAT_GOD))
6358 {
6359 absorb = damage;
6360 damage = 0;
6361 }
6362
6363 data << uint32(damage); // damage
6364 data << uint32(pInfo->overDamage); // overkill?
6365 data << uint32(aura->GetSpellInfo()->GetSchoolMask());
6366 data << uint32(absorb); // absorb
6367 data << uint32(pInfo->resist); // resist
6368 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6369 }
6370 break;
6373 data << uint32(pInfo->damage); // damage
6374 data << uint32(pInfo->overDamage); // overheal
6375 data << uint32(pInfo->absorb); // absorb
6376 data << uint8(pInfo->critical); // new 3.1.2 critical tick
6377 break;
6380 data << uint32(aura->GetMiscValue()); // power type
6381 data << uint32(pInfo->damage); // damage
6382 break;
6384 data << uint32(aura->GetMiscValue()); // power type
6385 data << uint32(pInfo->damage); // amount
6386 data << float(pInfo->multiplier); // gain multiplier
6387 break;
6388 default:
6389 LOG_ERROR("entities.unit", "Unit::SendPeriodicAuraLog: unknown aura {}", uint32(aura->GetAuraType()));
6390 return;
6391 }
6392
6393 SendMessageToSet(&data, true);
6394}
@ SPELL_AURA_OBS_MOD_HEALTH
Definition: SpellAuraDefines.h:83
@ SPELL_AURA_PERIODIC_MANA_LEECH
Definition: SpellAuraDefines.h:127
@ SPELL_AURA_PERIODIC_ENERGIZE
Definition: SpellAuraDefines.h:87
@ SMSG_PERIODICAURALOG
Definition: Opcodes.h:620
float multiplier
Definition: Unit.h:521
bool critical
Definition: Unit.h:522
uint32 overDamage
Definition: Unit.h:518
uint32 resist
Definition: Unit.h:520
uint32 damage
Definition: Unit.h:517
AuraEffect const * auraEff
Definition: Unit.h:516
uint32 absorb
Definition: Unit.h:519

References SpellPeriodicAuraLogInfo::absorb, SpellPeriodicAuraLogInfo::auraEff, CHEAT_GOD, SpellPeriodicAuraLogInfo::critical, SpellPeriodicAuraLogInfo::damage, AuraEffect::GetAuraType(), AuraEffect::GetCasterGUID(), AuraEffect::GetId(), AuraEffect::GetMiscValue(), Object::GetPackGUID(), SpellInfo::GetSchoolMask(), AuraEffect::GetSpellInfo(), Object::IsPlayer(), LOG_ERROR, SpellPeriodicAuraLogInfo::multiplier, SpellPeriodicAuraLogInfo::overDamage, SpellPeriodicAuraLogInfo::resist, WorldObject::SendMessageToSet(), SMSG_PERIODICAURALOG, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_OBS_MOD_POWER, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_ENERGIZE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_PERIODIC_MANA_LEECH, Object::ToPlayer(), and ObjectGuid::WriteAsPacked().

Referenced by AuraEffect::HandleObsModPowerAuraTick(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicEnergizeAuraTick(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SendPetActionFeedback()

void Unit::SendPetActionFeedback ( uint8  msg)

-------—Pet responses methods--------------—

16537{
16538 Unit* owner = GetOwner();
16539 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
16540 return;
16541
16543 data << uint8(msg);
16544 owner->ToPlayer()->GetSession()->SendPacket(&data);
16545}
@ SMSG_PET_ACTION_FEEDBACK
Definition: Opcodes.h:740

References GetOwner(), Player::GetSession(), Object::GetTypeId(), WorldSession::SendPacket(), SMSG_PET_ACTION_FEEDBACK, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by WorldSession::HandlePetCancelAuraOpcode().

◆ SendPetAIReaction()

void Unit::SendPetAIReaction ( ObjectGuid  guid)
16560{
16561 Unit* owner = GetOwner();
16562 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
16563 return;
16564
16565 WorldPacket data(SMSG_AI_REACTION, 8 + 4);
16566 data << guid;
16567 data << uint32(AI_REACTION_HOSTILE);
16568 owner->ToPlayer()->GetSession()->SendPacket(&data);
16569}
@ SMSG_AI_REACTION
Definition: Opcodes.h:346

References AI_REACTION_HOSTILE, GetOwner(), Player::GetSession(), Object::GetTypeId(), WorldSession::SendPacket(), SMSG_AI_REACTION, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by PetAI::DoAttack(), and WorldSession::HandlePetActionHelper().

◆ SendPetTalk()

void Unit::SendPetTalk ( uint32  pettalk)
16548{
16549 Unit* owner = GetOwner();
16550 if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
16551 return;
16552
16554 data << GetGUID();
16555 data << uint32(pettalk);
16556 owner->ToPlayer()->GetSession()->SendPacket(&data);
16557}
@ SMSG_PET_ACTION_SOUND
Definition: Opcodes.h:834

References Object::GetGUID(), GetOwner(), Player::GetSession(), Object::GetTypeId(), WorldSession::SendPacket(), SMSG_PET_ACTION_SOUND, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by WorldSession::HandlePetActionHelper().

◆ SendPlaySpellImpact()

void Unit::SendPlaySpellImpact ( ObjectGuid  guid,
uint32  id 
)
18837{
18839 data << guid; // target
18840 data << uint32(id); // SpellVisualKit.dbc index
18841 SendMessageToSet(&data, true);
18842}
@ SMSG_PLAY_SPELL_IMPACT
Definition: Opcodes.h:533

References WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_IMPACT.

Referenced by debug_commandscript::HandleDebugVisualCommand(), and WorldSession::HandleTrainerBuySpellOpcode().

◆ SendPlaySpellVisual()

void Unit::SendPlaySpellVisual ( uint32  id)
18829{
18831 data << GetGUID();
18832 data << uint32(id); // SpellVisualKit.dbc index
18833 SendMessageToSet(&data, true);
18834}
@ SMSG_PLAY_SPELL_VISUAL
Definition: Opcodes.h:529

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PLAY_SPELL_VISUAL.

Referenced by debug_commandscript::HandleDebugVisualCommand(), WorldSession::HandleTrainerBuySpellOpcode(), and Player::RegenerateAll().

◆ SendRemoveFromThreatListOpcode()

void Unit::SendRemoveFromThreatListOpcode ( HostileReference pHostileReference)
20047{
20048 LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message");
20049 WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8);
20050 data << GetPackGUID();
20051 data << pHostileReference->getUnitGuid().WriteAsPacked();
20052 SendMessageToSet(&data, false);
20053}
@ SMSG_THREAT_REMOVE
Definition: Opcodes.h:1186

References Object::GetPackGUID(), HostileReference::getUnitGuid(), LOG_DEBUG, WorldObject::SendMessageToSet(), SMSG_THREAT_REMOVE, and ObjectGuid::WriteAsPacked().

Referenced by ThreatMgr::processThreatEvent().

◆ SendSpellDamageImmune()

void Unit::SendSpellDamageImmune ( Unit target,
uint32  spellId 
)
6421{
6422 WorldPacket data(SMSG_SPELLORDAMAGE_IMMUNE, 8 + 8 + 4 + 1);
6423 data << GetGUID();
6424 data << target->GetGUID();
6425 data << uint32(spellId);
6426 data << uint8(0); // bool - log format: 0-default, 1-debug
6427 SendMessageToSet(&data, true);
6428}
@ SMSG_SPELLORDAMAGE_IMMUNE
Definition: Opcodes.h:641

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLORDAMAGE_IMMUNE.

Referenced by DealMeleeDamage(), and AuraEffect::SendTickImmune().

◆ SendSpellDamageResist()

void Unit::SendSpellDamageResist ( Unit target,
uint32  spellId 
)
6411{
6412 WorldPacket data(SMSG_PROCRESIST, 8 + 8 + 4 + 1);
6413 data << GetGUID();
6414 data << target->GetGUID();
6415 data << uint32(spellId);
6416 data << uint8(0); // bool - log format: 0-default, 1-debug
6417 SendMessageToSet(&data, true);
6418}
@ SMSG_PROCRESIST
Definition: Opcodes.h:638

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_PROCRESIST.

◆ SendSpellMiss()

void Unit::SendSpellMiss ( Unit target,
uint32  spellID,
SpellMissInfo  missInfo 
)
6397{
6398 WorldPacket data(SMSG_SPELLLOGMISS, (4 + 8 + 1 + 4 + 8 + 1));
6399 data << uint32(spellID);
6400 data << GetGUID();
6401 data << uint8(0); // can be 0 or 1
6402 data << uint32(1); // target count
6403 // for (i = 0; i < target count; ++i)
6404 data << target->GetGUID(); // target GUID
6405 data << uint8(missInfo);
6406 // end loop
6407 SendMessageToSet(&data, true);
6408}
@ SMSG_SPELLLOGMISS
Definition: Opcodes.h:617

References Object::GetGUID(), WorldObject::SendMessageToSet(), and SMSG_SPELLLOGMISS.

Referenced by DealMeleeDamage(), and Spell::DoAllEffectOnTarget().

◆ SendSpellNonMeleeDamageLog() [1/2]

void Unit::SendSpellNonMeleeDamageLog ( SpellNonMeleeDamage log)
6262{
6263 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6264 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6265 uint32 damage = log->damage;
6266 uint32 absorb = log->absorb;
6267 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6268 {
6269 absorb = damage;
6270 damage = 0;
6271 }
6272 data << log->target->GetPackGUID();
6273 data << log->attacker->GetPackGUID();
6274 data << uint32(log->spellInfo->Id);
6275 data << uint32(damage); // damage amount
6276 int32 overkill = damage - log->target->GetHealth();
6277 data << uint32(overkill > 0 ? overkill : 0); // overkill
6278 data << uint8 (log->schoolMask); // damage school
6279 data << uint32(absorb); // AbsorbedDamage
6280 data << uint32(log->resist); // resist
6281 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6282 data << uint8 (log->unused); // unused
6283 data << uint32(log->blocked); // blocked
6284 data << uint32(log->HitInfo);
6285 data << uint32(log->HitInfo);
6287 //if (log->HitInfo & SPELL_HIT_TYPE_CRIT_DEBUG)
6288 //{
6289 // data << float(log->CritRoll);
6290 // data << float(log->CritNeeded);
6291 //}
6292 //if (log->HitInfo & SPELL_HIT_TYPE_HIT_DEBUG)
6293 //{
6294 // data << float(log->HitRoll);
6295 // data << float(log->HitNeeded);
6296 //}
6297 //if (log->HitInfo & SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG)
6298 //{
6299 // data << float(log->MissChance);
6300 // data << float(log->DodgeChance);
6301 // data << float(log->ParryChance);
6302 // data << float(log->BlockChance);
6303 // data << float(log->GlanceChance);
6304 // data << float(log->CrushChance);
6305 //}
6306 SendMessageToSet(&data, true);
6307}
@ SPELL_HIT_TYPE_HIT_DEBUG
Definition: SharedDefines.h:1537
@ SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG
Definition: SharedDefines.h:1540
@ SPELL_HIT_TYPE_CRIT_DEBUG
Definition: SharedDefines.h:1535
@ SMSG_SPELLNONMELEEDAMAGELOG
Definition: Opcodes.h:622
bool physicalLog
Definition: Unit.h:503
bool unused
Definition: Unit.h:504

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::attacker, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, WorldObject::SendMessageToSet(), SMSG_SPELLNONMELEEDAMAGELOG, SPELL_HIT_TYPE_ATTACK_TABLE_DEBUG, SPELL_HIT_TYPE_CRIT_DEBUG, SPELL_HIT_TYPE_HIT_DEBUG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), and SpellNonMeleeDamage::unused.

Referenced by CalcAbsorbResist(), DealDamage(), Spell::DoAllEffectOnTarget(), Spell::EffectEnvironmentalDMG(), spell_sindragosa_s_fury::HandleDummy(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandlePeriodicPowerBurnAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and SendSpellNonMeleeDamageLog().

◆ SendSpellNonMeleeDamageLog() [2/2]

void Unit::SendSpellNonMeleeDamageLog ( Unit target,
SpellInfo const *  spellInfo,
uint32  Damage,
SpellSchoolMask  damageSchoolMask,
uint32  AbsorbedDamage,
uint32  Resist,
bool  PhysicalDamage,
uint32  Blocked,
bool  CriticalHit = false,
bool  Split = false 
)
6310{
6311 SpellNonMeleeDamage log(this, target, spellInfo, damageSchoolMask);
6312 log.damage = Damage;
6313 log.absorb = AbsorbedDamage;
6314 log.resist = Resist;
6315 log.physicalLog = PhysicalDamage;
6316 log.blocked = Blocked;
6317 log.HitInfo = 0;
6318 if (CriticalHit)
6319 {
6320 log.HitInfo |= SPELL_HIT_TYPE_CRIT;
6321 }
6322 if (Split)
6323 {
6324 log.HitInfo |= SPELL_HIT_TYPE_SPLIT;
6325 }
6327}
@ SPELL_HIT_TYPE_SPLIT
Definition: SharedDefines.h:1538
Definition: Unit.h:489

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, SpellNonMeleeDamage::damage, SpellNonMeleeDamage::HitInfo, SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SendSpellNonMeleeDamageLog(), SPELL_HIT_TYPE_CRIT, and SPELL_HIT_TYPE_SPLIT.

◆ SendSpellNonMeleeReflectLog()

void Unit::SendSpellNonMeleeReflectLog ( SpellNonMeleeDamage log,
Unit attacker 
)
6230{
6231 // Xinef: function for players only, placed in unit because of cosmetics
6232 if (GetTypeId() != TYPEID_PLAYER)
6233 return;
6234
6235 WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16 + 4 + 4 + 4 + 1 + 4 + 4 + 1 + 1 + 4 + 4 + 1)); // we guess size
6236 //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop
6237 uint32 damage = log->damage;
6238 uint32 absorb = log->absorb;
6239 if (log->target->IsPlayer() && log->target->ToPlayer()->GetCommandStatus(CHEAT_GOD))
6240 {
6241 absorb = damage;
6242 damage = 0;
6243 }
6244 data << log->target->GetPackGUID();
6245 data << attacker->GetPackGUID();
6246 data << uint32(log->spellInfo->Id);
6247 data << uint32(damage); // damage amount
6248 int32 overkill = damage - log->target->GetHealth();
6249 data << uint32(overkill > 0 ? overkill : 0); // overkill
6250 data << uint8 (log->schoolMask); // damage school
6251 data << uint32(absorb); // AbsorbedDamage
6252 data << uint32(log->resist); // resist
6253 data << uint8 (log->physicalLog); // if 1, then client show spell name (example: %s's ranged shot hit %s for %u school or %s suffers %u school damage from %s's spell_name
6254 data << uint8 (log->unused); // unused
6255 data << uint32(log->blocked); // blocked
6256 data << uint32(log->HitInfo);
6257 data << uint8 (0); // flag to use extend data
6258 ToPlayer()->SendDirectMessage(&data);
6259}

References SpellNonMeleeDamage::absorb, SpellNonMeleeDamage::blocked, CHEAT_GOD, SpellNonMeleeDamage::damage, Player::GetCommandStatus(), GetHealth(), Object::GetPackGUID(), Object::GetTypeId(), SpellNonMeleeDamage::HitInfo, SpellInfo::Id, Object::IsPlayer(), SpellNonMeleeDamage::physicalLog, SpellNonMeleeDamage::resist, SpellNonMeleeDamage::schoolMask, Player::SendDirectMessage(), SMSG_SPELLNONMELEEDAMAGELOG, SpellNonMeleeDamage::spellInfo, SpellNonMeleeDamage::target, Object::ToPlayer(), TYPEID_PLAYER, and SpellNonMeleeDamage::unused.

Referenced by Spell::DoAllEffectOnTarget().

◆ SendTameFailure()

void Unit::SendTameFailure ( uint8  result)
19919{
19921 data << uint8(result);
19922 ToPlayer()->SendDirectMessage(&data);
19923}
@ SMSG_PET_TAME_FAILURE
Definition: Opcodes.h:401

References Player::SendDirectMessage(), SMSG_PET_TAME_FAILURE, and Object::ToPlayer().

Referenced by spell_hun_tame_beast::CheckCast(), and Spell::CheckCast().

◆ SendTeleportPacket()

void Unit::SendTeleportPacket ( Position pos)

◆ SendThreatListUpdate()

void Unit::SendThreatListUpdate ( )
19998{
19999 if (!GetThreatMgr().isThreatListEmpty())
20000 {
20001 uint32 count = GetThreatMgr().GetThreatList().size();
20002
20003 //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
20004 WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
20005 data << GetPackGUID();
20006 data << uint32(count);
20008 for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
20009 {
20010 data << (*itr)->getUnitGuid().WriteAsPacked();
20011 data << uint32((*itr)->GetThreat() * 100);
20012 }
20013 SendMessageToSet(&data, false);
20014 }
20015}
@ SMSG_THREAT_UPDATE
Definition: Opcodes.h:1185

References Object::GetPackGUID(), ThreatMgr::GetThreatList(), GetThreatMgr(), WorldObject::SendMessageToSet(), and SMSG_THREAT_UPDATE.

Referenced by Update().

◆ SetAI()

void Unit::SetAI ( UnitAI newAI)
inline
657{ i_AI = newAI; }

References i_AI.

◆ SetArmor()

void Unit::SetArmor ( int32  val)
inline

◆ SetAttackTime()

◆ setAttackTimer()

◆ SetAuraStack()

void Unit::SetAuraStack ( uint32  spellId,
Unit target,
uint32  stack 
)
18820{
18821 Aura* aura = target->GetAura(spellId, GetGUID());
18822 if (!aura)
18823 aura = AddAura(spellId, target);
18824 if (aura && stack)
18825 aura->SetStackAmount(stack);
18826}
void SetStackAmount(uint8 num)
Definition: SpellAuras.cpp:995

References AddAura(), GetAura(), Object::GetGUID(), and Aura::SetStackAmount().

Referenced by boss_viscidus::DamageTaken(), spell_capacitus_polarity_charge::HandleTargets(), spell_thaddius_pos_neg_charge::HandleTargets(), and BattlefieldWG::OnPlayerJoinWar().

◆ SetBaseWeaponDamage()

void Unit::SetBaseWeaponDamage ( WeaponAttackType  attType,
WeaponDamageRange  damageRange,
float  value,
uint8  damageIndex = 0 
)
inline
1461{ m_weaponDamage[attType][damageRange][damageIndex] = value; }

References m_weaponDamage.

Referenced by Player::_ApplyWeaponDamage(), Guardian::InitStatsForLevel(), and Creature::SelectLevel().

◆ SetCanDualWield()

virtual void Unit::SetCanDualWield ( bool  value)
inlinevirtual

◆ SetCanFly()

bool Unit::SetCanFly ( bool  enable,
bool  packetOnly = false 
)
virtual

Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pressing space for example. For creatures, please look for DisableGravity().

Doesn't inform the client.

Reimplemented in Player, and Creature.

20511{
20513 return false;
20514
20515 if (enable)
20516 {
20519 }
20520 else
20521 {
20523 }
20524
20525 return true;
20526}
@ MOVEMENTFLAG_CAN_FLY
Definition: UnitDefines.h:368
@ MOVEMENTFLAG_MASK_MOVING_FLY
Definition: UnitDefines.h:385
void AddUnitMovementFlag(uint32 f)
Definition: Unit.h:1615

References AddUnitMovementFlag(), HasUnitMovementFlag(), MOVEMENTFLAG_CAN_FLY, MOVEMENTFLAG_FALLING, MOVEMENTFLAG_MASK_MOVING_FLY, and RemoveUnitMovementFlag().

Referenced by AuraEffect::HandleAuraAllowFlight(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnApply(), spell_chapter5_light_of_dawn_aura::spell_chapter5_light_of_dawn_aura_AuraScript::OnRemove(), Player::SetCanFly(), and Creature::SetCanFly().

◆ SetCanModifyStats()

◆ SetCantProc()

void Unit::SetCantProc ( bool  apply)
inline
1665 {
1666 if (apply)
1667 ++m_procDeep;
1668 else
1669 {
1671 --m_procDeep;
1672 }
1673 }

References ASSERT, and m_procDeep.

Referenced by HandleDummyAuraProc(), and ProcDamageAndSpellFor().

◆ SetCharm()

void Unit::SetCharm ( Unit target,
bool  apply 
)
Todo:
: maybe we can use this flag to check if controlled by player
10812{
10813 if (apply)
10814 {
10815 if (IsPlayer())
10816 {
10817 if (!AddGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
10818 LOG_FATAL("entities.unit", "Player {} is trying to charm unit {}, but it already has a charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
10819
10820 charm->m_ControlledByPlayer = true;
10822 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10823 }
10824 else
10825 charm->m_ControlledByPlayer = false;
10826
10827 // PvP, FFAPvP
10828 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
10829
10830 if (!charm->AddGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
10831 LOG_FATAL("entities.unit", "Unit {} is being charmed, but it already has a charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
10832
10833 _isWalkingBeforeCharm = charm->IsWalking();
10835 {
10836 charm->SetWalk(false);
10837 charm->SendMovementFlagUpdate();
10838 }
10839
10840 m_Controlled.insert(charm);
10841 }
10842 else
10843 {
10844 if (IsPlayer())
10845 {
10846 if (!RemoveGuidValue(UNIT_FIELD_CHARM, charm->GetGUID()))
10847 LOG_FATAL("entities.unit", "Player {} is trying to uncharm unit {}, but it has another charmed unit {}", GetName(), charm->GetEntry(), GetCharmGUID().ToString());
10848 }
10849
10850 if (!charm->RemoveGuidValue(UNIT_FIELD_CHARMEDBY, GetGUID()))
10851 LOG_FATAL("entities.unit", "Unit {} is being uncharmed, but it has another charmer {}", charm->GetEntry(), charm->GetCharmerGUID().ToString());
10852
10853 if (charm->IsPlayer())
10854 {
10855 charm->m_ControlledByPlayer = true;
10856 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10857 charm->ToPlayer()->UpdatePvPState();
10858 }
10859 else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself())
10860 {
10861 charm->m_ControlledByPlayer = true;
10862 charm->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10863 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1));
10864
10865 // Xinef: skip controlled erase if charmed unit is owned by charmer
10866 if (charm->IsInWorld() && !charm->IsDuringRemoveFromWorld() && player->GetGUID() == this->GetGUID() && (charm->IsPet() || charm->HasUnitTypeMask(UNIT_MASK_MINION)))
10867 return;
10868 }
10869 else
10870 {
10871 charm->m_ControlledByPlayer = false;
10872 charm->RemoveUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
10873 charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0);
10874 }
10875
10876 if (charm->IsWalking() != _isWalkingBeforeCharm)
10877 {
10878 charm->SetWalk(_isWalkingBeforeCharm);
10879 charm->SendMovementFlagUpdate(true); // send packet to self, to update movement state on player.
10880 }
10881
10882 m_Controlled.erase(charm);
10883 }
10884}
bool AddGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:686
bool RemoveGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:704

References _isWalkingBeforeCharm, Object::AddGuidValue(), Object::GetByteValue(), GetCharmerGUID(), GetCharmerOrOwnerPlayerOrPlayerItself(), GetCharmGUID(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetName(), HasUnitTypeMask(), IsDuringRemoveFromWorld(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), IsWalking(), LOG_FATAL, m_Controlled, m_ControlledByPlayer, Object::RemoveGuidValue(), RemoveUnitFlag(), SendMovementFlagUpdate(), Object::SetByteValue(), SetUnitFlag(), SetWalk(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), UNIT_FIELD_BYTES_2, UNIT_FIELD_CHARM, UNIT_FIELD_CHARMEDBY, UNIT_FLAG_PLAYER_CONTROLLED, UNIT_MASK_MINION, and Player::UpdatePvPState().

Referenced by RemoveCharmedBy(), SetCharmedBy(), and Player::StopCastingCharm().

◆ SetCharmedBy()

bool Unit::SetCharmedBy ( Unit charmer,
CharmType  type,
AuraApplication const *  aurApp = nullptr 
)
18268{
18269 if (!charmer)
18270 return false;
18271
18272 if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld())
18273 {
18274 return false;
18275 }
18276
18277 // dismount players when charmed
18278 if (IsPlayer())
18280
18281 if (charmer->IsPlayer())
18283
18284 ASSERT(type != CHARM_TYPE_POSSESS || charmer->IsPlayer());
18285 if (type == CHARM_TYPE_VEHICLE && !IsVehicle()) // pussywizard
18286 throw 1;
18287 ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle());
18288
18289 LOG_DEBUG("entities.unit", "SetCharmedBy: charmer {} ({}), charmed {} ({}), type {}.",
18290 charmer->GetEntry(), charmer->GetGUID().ToString(), GetEntry(), GetGUID().ToString(), uint32(type));
18291
18292 if (this == charmer)
18293 {
18294 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Unit {} ({}) is trying to charm itself!", GetEntry(), GetGUID().ToString());
18295 return false;
18296 }
18297
18298 //if (HasUnitState(UNIT_STATE_UNATTACKABLE))
18299 // return false;
18300
18301 if (IsPlayer() && ToPlayer()->GetTransport())
18302 {
18303 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: Player on transport is trying to charm {} ({})", GetEntry(), GetGUID().ToString());
18304 return false;
18305 }
18306
18307 // Already charmed
18308 if (GetCharmerGUID())
18309 {
18310 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) has already been charmed but {} ({}) is trying to charm it!",
18311 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
18312 return false;
18313 }
18314
18315 CastStop();
18316 AttackStop();
18317
18318 // Xinef: dont reset threat and combat, put them on offline list, moved down after faction changes
18319 // CombatStop(); /// @todo: CombatStop(true) may cause crash (interrupt spells)
18320 // DeleteThreatList();
18321
18322 Player* playerCharmer = charmer->ToPlayer();
18323
18324 // Charmer stop charming
18325 if (playerCharmer)
18326 {
18327 playerCharmer->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
18328 playerCharmer->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
18329 }
18330
18331 // Charmed stop charming
18332 if (IsPlayer())
18333 {
18334 ToPlayer()->StopCastingCharm(aurApp ? aurApp->GetBase() : nullptr);
18335 ToPlayer()->StopCastingBindSight(aurApp ? aurApp->GetBase() : nullptr);
18336 }
18337
18338 // StopCastingCharm may remove a possessed pet?
18339 if (!IsInWorld())
18340 {
18341 LOG_FATAL("entities.unit", "Unit::SetCharmedBy: {} ({}) is not in world but {} ({}) is trying to charm it!",
18342 GetEntry(), GetGUID().ToString(), charmer->GetEntry(), charmer->GetGUID().ToString());
18343 return false;
18344 }
18345
18346 // charm is set by aura, and aura effect remove handler was called during apply handler execution
18347 // prevent undefined behaviour
18348 if (aurApp && aurApp->GetRemoveMode())
18349 return false;
18350
18352 SetFaction(charmer->GetFaction());
18353
18354 // Set charmed
18355 charmer->SetCharm(this, true);
18356
18358
18359 if (GetTypeId() == TYPEID_UNIT)
18360 {
18361 GetMotionMaster()->Clear(false);
18363 StopMoving();
18364
18365 if (charmer->IsPlayer() && charmer->IsClass(CLASS_WARLOCK, CLASS_CONTEXT_PET_CHARM) && ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_DEMON)
18366 {
18367 // Disable CreatureAI/SmartAI and switch to CharmAI when charmed by warlock
18368 Creature* charmed = ToCreature();
18369 charmed->NeedChangeAI = true;
18370 charmed->IsAIEnabled = false;
18371 }
18372 else
18373 {
18374 ToCreature()->AI()->OnCharmed(true);
18375 }
18376
18377 // Xinef: If creature can fly, add normal player flying flag (fixes speed)
18378 if (charmer->IsPlayer() && ToCreature()->CanFly())
18380 }
18381 else
18382 {
18383 Player* player = ToPlayer();
18384 if (player->isAFK())
18385 player->ToggleAFK();
18386
18387 player->SetClientControl(this, false); // verified
18388 }
18389
18390 // charm is set by aura, and aura effect remove handler was called during apply handler execution
18391 // prevent undefined behaviour
18392 if (aurApp && aurApp->GetRemoveMode())
18393 return false;
18394
18395 // Pets already have a properly initialized CharmInfo, don't overwrite it.
18396 // Xinef: I need charmInfo for vehicle
18397 if (/*type != CHARM_TYPE_VEHICLE &&*/ !GetCharmInfo())
18398 {
18399 InitCharmInfo();
18400 if (type == CHARM_TYPE_POSSESS)
18402 else if (type != CHARM_TYPE_VEHICLE)
18403 {
18405
18406 // Xinef: convert charm npcs dont have pet bar so initialize them as defensive helpers
18407 if (type == CHARM_TYPE_CONVERT && GetTypeId() == TYPEID_UNIT)
18409 }
18410 }
18411
18412 if (playerCharmer)
18413 {
18414 switch (type)
18415 {
18416 case CHARM_TYPE_VEHICLE:
18419 playerCharmer->SetClientControl(this, true); // verified
18420 playerCharmer->VehicleSpellInitialize();
18421 break;
18422 case CHARM_TYPE_POSSESS:
18427 playerCharmer->SetClientControl(this, true); // verified
18428 playerCharmer->PossessSpellInitialize();
18429 break;
18430 case CHARM_TYPE_CHARM:
18432 {
18434 if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
18435 {
18436 // to prevent client crash
18438
18439 // just to enable stat window
18440 if (GetCharmInfo())
18441 GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
18442
18443 // if charmed two demons the same session, the 2nd gets the 1st one's name
18444 SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped
18445 }
18446 }
18447 if (playerCharmer->m_seer != this)
18448 {
18450 playerCharmer->CharmSpellInitialize();
18451 }
18452 break;
18453 default:
18454 break;
18455 }
18456 }
18457 else if (IsPlayer())
18459
18460 if (Creature* creature = ToCreature())
18461 creature->RefreshSwimmingFlag();
18462
18463 if (IsPlayer())
18464 sScriptMgr->OnPlayerBeingCharmed(ToPlayer(), charmer, _oldFactionId, charmer->GetFaction());
18465
18466 return true;
18467}
@ UNIT_FIELD_PET_NAME_TIMESTAMP
Definition: UpdateFields.h:133
@ REACT_DEFENSIVE
Definition: Unit.h:549
@ CHARM_TYPE_CONVERT
Definition: CharmInfo.h:47
void OnCharmed(bool apply) override
Called when unit is charmed.
Definition: CreatureAI.cpp:33
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition: Creature.h:97
void CharmSpellInitialize()
Definition: Player.cpp:9599
WorldObject * m_seer
Definition: Player.h:2310
void ToggleAFK()
Definition: Player.cpp:1288
void PossessSpellInitialize()
Definition: Player.cpp:9496
bool isAFK() const
Definition: Player.h:1133
void VehicleSpellInitialize()
Definition: Player.cpp:9524
void StopCastingBindSight(Aura *except=nullptr)
Definition: Player.cpp:13103
void InitPossessCreateSpells()
Definition: CharmInfo.cpp:77
void InitCharmCreateSpells()
Definition: CharmInfo.cpp:111
virtual float GetFollowAngle() const
Definition: Unit.h:1735
CharmInfo * InitCharmInfo()
Definition: Unit.cpp:15739
void MoveIdle()
Definition: MotionMaster.cpp:232

References _oldFactionId, AddUnitMovementFlag(), AddUnitState(), Creature::AI(), ASSERT, AttackStop(), CanFly(), CastStop(), CHARM_TYPE_CHARM, CHARM_TYPE_CONVERT, CHARM_TYPE_POSSESS, CHARM_TYPE_VEHICLE, Player::CharmSpellInitialize(), CLASS_CONTEXT_PET_CHARM, CLASS_MAGE, CLASS_WARLOCK, MotionMaster::Clear(), CREATURE_TYPE_DEMON, AuraApplication::GetBase(), GetCharmerGUID(), GetCharmInfo(), Creature::GetCreatureTemplate(), Object::GetEntry(), GetFaction(), GetFollowAngle(), GameTime::GetGameTime(), Object::GetGUID(), GetMotionMaster(), AuraApplication::GetRemoveMode(), WorldObject::GetTransport(), Object::GetTypeId(), CharmInfo::InitCharmCreateSpells(), InitCharmInfo(), CharmInfo::InitPossessCreateSpells(), Player::isAFK(), IsAIEnabled, IsClass(), IsDuringRemoveFromWorld(), Object::IsInWorld(), Object::IsPlayer(), IsVehicle(), LOG_DEBUG, LOG_FATAL, Player::m_seer, MotionMaster::MoveFollow(), MotionMaster::MoveIdle(), MOVEMENTFLAG_FLYING, NeedChangeAI, CreatureAI::OnCharmed(), PET_FOLLOW_DIST, Player::PossessSpellInitialize(), REACT_DEFENSIVE, RemoveAurasByType(), Object::SetByteValue(), SetCharm(), Player::SetClientControl(), SetFaction(), CharmInfo::SetPetNumber(), Creature::SetReactState(), SetUInt32Value(), SetUnitFlag(), sObjectMgr, SPELL_AURA_MOD_SHAPESHIFT, SPELL_AURA_MOUNTED, sScriptMgr, StopAttackingInvalidTarget(), Player::StopCastingBindSight(), Player::StopCastingCharm(), StopMoving(), Object::ToCreature(), Player::ToggleAFK(), Object::ToPlayer(), ObjectGuid::ToString(), Position::ToString(), CreatureTemplate::type, TYPEID_UNIT, UNIT_FIELD_BYTES_0, UNIT_FIELD_PET_NAME_TIMESTAMP, UNIT_FLAG_DISABLE_MOVE, UNIT_FLAG_POSSESSED, UNIT_STATE_NO_ENVIRONMENT_UPD, UNIT_STATE_POSSESSED, and Player::VehicleSpellInitialize().

Referenced by Vehicle::AddPassenger(), AuraEffect::HandleCharmConvert(), AuraEffect::HandleModCharm(), AuraEffect::HandleModPossess(), AuraEffect::HandleModPossessPet(), and Puppet::InitSummon().

◆ SetCharmerGUID()

void Unit::SetCharmerGUID ( ObjectGuid  owner)
inline

◆ SetCombatTimer()

void Unit::SetCombatTimer ( uint32  timer)
inline
1043{ m_CombatTimer = timer; }

References m_CombatTimer.

◆ SetConfused()

void Unit::SetConfused ( bool  apply)
protected
18236{
18237 if (apply)
18238 {
18239 SetTarget();
18241 }
18242 else
18243 {
18244 if (IsAlive())
18245 {
18246 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == CONFUSED_MOTION_TYPE)
18247 {
18249 StopMoving();
18250 }
18251
18252 if (GetVictim())
18254 }
18255 }
18256
18257 // xinef: block / allow control to real mover (eg. charmer)
18258 if (IsPlayer())
18259 {
18260 if (m_movedByPlayer)
18261 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
18262 //else
18263 // ToPlayer()->SetClientControl(this, !apply);
18264 }
18265}
@ CONFUSED_MOTION_TYPE
Definition: MotionMaster.h:42
void MoveConfused()
Enable the confusion movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:292

References CONFUSED_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveConfused(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), StopMoving(), and Object::ToPlayer().

Referenced by SetControlled().

◆ SetContestedPvP()

void Unit::SetContestedPvP ( Player attackedPlayer = nullptr,
bool  lookForNearContestedGuards = true 
)
17177{
17179
17180 if (!player || ((attackedPlayer && (attackedPlayer == player || (player->duel && player->duel->Opponent == attackedPlayer))) || player->InBattleground()))
17181 return;
17182
17183 // check if there any guards that should care about the contested flag on player
17184 if (lookForNearContestedGuards)
17185 {
17186 std::list<Unit*> targets;
17189 Cell::VisitAllObjects(this, searcher, MAX_AGGRO_RADIUS);
17190
17191 // return if there are no contested guards found
17192 if (!targets.size())
17193 {
17194 return;
17195 }
17196 }
17197
17198 player->SetContestedPvPTimer(30000);
17200 {
17203 // call MoveInLineOfSight for nearby contested guards
17205 }
17207 {
17209 // call MoveInLineOfSight for nearby contested guards
17211 }
17212}
#define MAX_AGGRO_RADIUS
Definition: Unit.h:43
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:1108
bool InBattleground() const
Definition: Player.h:2228
void SetContestedPvPTimer(uint32 newTime)
Definition: Player.h:1845

References WorldObject::AddToNotify(), AddUnitState(), Player::duel, GetCharmerOrOwnerPlayerOrPlayerItself(), HasUnitState(), Player::InBattleground(), MAX_AGGRO_RADIUS, NOTIFY_AI_RELOCATION, PLAYER_FLAGS_CONTESTED_PVP, Player::SetContestedPvPTimer(), Player::SetPlayerFlag(), UNIT_STATE_ATTACK_PLAYER, and Cell::VisitAllObjects().

Referenced by CombatStart(), CombatStartOnCast(), Spell::DoSpellHitOnUnit(), and WorldSession::HandlePlayerLoginFromDB().

◆ SetControlled()

void Unit::SetControlled ( bool  apply,
UnitState  state,
Unit source = nullptr,
bool  isFear = false 
)
17952{
17953 if (apply)
17954 {
17955 if (HasUnitState(state))
17956 return;
17957
17958 AddUnitState(state);
17959 switch (state)
17960 {
17961 case UNIT_STATE_STUNNED:
17962 SetStunned(true);
17963 break;
17964 case UNIT_STATE_ROOT:
17966 SetRooted(true);
17967 break;
17970 {
17973 // SendAutoRepeatCancel ?
17974 SetConfused(true);
17975 CastStop(0, false);
17976 }
17977 break;
17978 case UNIT_STATE_FLEEING:
17980 {
17983 // SendAutoRepeatCancel ?
17984 SetFeared(true, source, isFear);
17985 CastStop(0, false);
17986 }
17987 break;
17988 default:
17989 break;
17990 }
17991
17992 if (IsPlayer())
17993 {
17994 sScriptMgr->AnticheatSetRootACKUpd(ToPlayer());
17995 }
17996 }
17997 else
17998 {
17999 // xinef: moved from below, checked all SetX functions, no calls to currently modified state
18000 // xinef: added to each case because of return
18001 //ClearUnitState(state);
18002
18003 switch (state)
18004 {
18005 case UNIT_STATE_STUNNED:
18007 return;
18008 ClearUnitState(state);
18009 SetStunned(false);
18010 break;
18011 case UNIT_STATE_ROOT:
18012 // Prevent creature_template_movement rooted flag from being removed on aura expiration.
18013 if (GetTypeId() == TYPEID_UNIT)
18014 {
18015 if (ToCreature()->GetCreatureTemplate()->Movement.Rooted)
18016 {
18017 return;
18018 }
18019 }
18020
18022 return;
18023 ClearUnitState(state);
18024 SetRooted(false);
18025 break;
18028 return;
18029 ClearUnitState(state);
18030 SetConfused(false);
18031 break;
18032 case UNIT_STATE_FLEEING:
18034 return;
18035 ClearUnitState(state);
18036 SetFeared(false);
18037 break;
18038 default:
18039 return;
18040 }
18041
18042 //ClearUnitState(state);
18043
18045 SetStunned(true);
18046 else
18047 {
18049 SetRooted(true);
18050
18052 SetConfused(true);
18054 {
18055 bool isFear = false;
18057 {
18058 isFear = true;
18059 source = ObjectAccessor::GetUnit(*this, GetAuraEffectsByType(SPELL_AURA_MOD_FEAR).front()->GetCasterGUID());
18060 }
18061
18062 if (!source)
18063 {
18064 source = getAttackerForHelper();
18065 }
18066
18067 SetFeared(true, source, isFear);
18068 }
18069 }
18070 }
18071}
Definition: Unit.h:257
void SetFeared(bool apply, Unit *fearedBy=nullptr, bool isFear=false)
Definition: Unit.cpp:18203
void SetConfused(bool apply)
Definition: Unit.cpp:18235
void SetStunned(bool apply)
Definition: Unit.cpp:18073
Unit * getAttackerForHelper() const
Definition: Unit.h:706
void SetRooted(bool apply, bool isStun=false)
Definition: Unit.cpp:18121

References AddUnitState(), CastStop(), ClearUnitState(), getAttackerForHelper(), GetAuraEffectsByType(), Object::GetTypeId(), ObjectAccessor::GetUnit(), GetVehicle(), HasAuraType(), HasUnitState(), Object::IsPlayer(), SendMeleeAttackStop(), SetConfused(), SetFeared(), SetRooted(), SetStunned(), SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_FEAR, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_UNIT, UNIT_STATE_CONFUSED, UNIT_STATE_FLEEING, UNIT_STATE_MELEE_ATTACKING, UNIT_STATE_ROOT, and UNIT_STATE_STUNNED.

Referenced by _ExitVehicle(), Vehicle::AddPassenger(), boss_ahune::boss_ahune(), boss_ouro::boss_ouro(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), boss_palehoof::boss_palehoofAI::DoAction(), Creature::DoFleeToGetAssistance(), boss_skeram::DoTeleport(), CritterAI::EnterEvadeMode(), boss_devourer_of_souls::boss_devourer_of_soulsAI::EnterEvadeMode(), boss_falric::boss_falricAI::EnterEvadeMode(), boss_garfrost::boss_garfrostAI::EnterEvadeMode(), boss_rotface::boss_rotfaceAI::EnterEvadeMode(), boss_noth::boss_nothAI::EnterEvadeMode(), boss_thaddius_summon::boss_thaddius_summonAI::EnterEvadeMode(), boss_urom::boss_uromAI::EnterEvadeMode(), boss_varos::boss_varosAI::EnterEvadeMode(), boss_ignis::boss_ignisAI::EnterEvadeMode(), boss_razorscale::boss_razorscaleAI::EnterEvadeMode(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::EnterEvadeMode(), boss_svala::boss_svalaAI::EnterEvadeMode(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_shirrak_the_dead_watcher::EnterEvadeMode(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleAuraModRoot(), AuraEffect::HandleAuraModStun(), debug_commandscript::HandleDebugMoveflagsCommand(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_mc_play_dead_aura::HandleEffectApply(), spell_gen_visual_dummy_stun::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_mc_play_dead_aura::HandleEffectRemove(), spell_gen_visual_dummy_stun::HandleEffectRemove(), AuraEffect::HandleModConfuse(), AuraEffect::HandleModFear(), AuraEffect::HandlePreventFleeing(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleRemove(), boss_volazj::JustDied(), CritterAI::JustEngagedWith(), boss_skadi::boss_skadiAI::JustEngagedWith(), boss_skeram::JustSummoned(), npc_twilight_volunteer::MovementInform(), boss_garfrost::boss_garfrostAI::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), npc_gunship_gunner::npc_gunship_gunnerAI::MovementInform(), npc_gunship_rocketeer::npc_gunship_rocketeerAI::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_iron_watcher::npc_iron_watcherAI::MovementInform(), npc_buru_egg::npc_buru_egg(), npc_icc_blood_beast::npc_icc_blood_beastAI::npc_icc_blood_beastAI(), npc_raging_spirit::npc_raging_spiritAI::npc_raging_spiritAI(), npc_vengeful_shade::npc_vengeful_shadeAI::npc_vengeful_shadeAI(), spell_systems_shutdown_aura::OnApply(), spell_systems_shutdown_aura::OnRemove(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_skeram::Reset(), boss_volazj::Reset(), npc_twilight_summon::npc_twilight_summonAI::Reset(), boss_devourer_of_souls::boss_devourer_of_soulsAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_garfrost::boss_garfrostAI::Reset(), boss_noth::boss_nothAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_thaddius_summon::boss_thaddius_summonAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_ignis::boss_ignisAI::Reset(), boss_thorim_pillar::boss_thorim_pillarAI::Reset(), boss_xt002::boss_xt002AI::Reset(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::Reset(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), boss_skadi::boss_skadiAI::Reset(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_iron_watcher::npc_iron_watcherAI::Reset(), boss_shirrak_the_dead_watcher::Reset(), npc_target_dummy::npc_target_dummyAI::Reset(), Player::SetClientControl(), boss_urom::boss_uromAI::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_garfrost::boss_garfrostAI::SpellHitTarget(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_volkhan::boss_volkhanAI::SpellHitTarget(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), boss_ionar::boss_ionarAI::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_noth::boss_nothAI::StartGroundPhase(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonedCreatureDies(), boss_skeram::UpdateAI(), boss_volazj::UpdateAI(), boss_falric::boss_falricAI::UpdateAI(), npc_icc_blood_beast::npc_icc_blood_beastAI::UpdateAI(), npc_vengeful_shade::npc_vengeful_shadeAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), boss_thaddius::boss_thaddiusAI::UpdateAI(), boss_thaddius_summon::boss_thaddius_summonAI::UpdateAI(), boss_urom::boss_uromAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), boss_loken::boss_lokenAI::UpdateAI(), boss_ignis::boss_ignisAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_yoggsaron_immortal_guardian::boss_yoggsaron_immortal_guardianAI::UpdateAI(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), boss_palehoof::boss_palehoofAI::UpdateAI(), boss_skadi::boss_skadiAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_cyanigosa::boss_cyanigosaAI::UpdateAI(), npc_tournament_training_dummy::npc_tournament_training_dummyAI::UpdateAI(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::UpdateAI(), npc_target_dummy::npc_target_dummyAI::UpdateAI(), Creature::UpdateEntry(), and npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached().

◆ SetCreateHealth()

◆ SetCreateMana()

◆ SetCreateStat()

void Unit::SetCreateStat ( Stats  stat,
float  val 
)
inline

◆ SetCreatorGUID()

◆ SetCritterGUID()

void Unit::SetCritterGUID ( ObjectGuid  guid)
inline

References Object::SetGuidValue(), and UNIT_FIELD_CRITTER.

Referenced by SetMinion().

◆ SetCurrentCastedSpell()

void Unit::SetCurrentCastedSpell ( Spell pSpell)
3925{
3926 ASSERT(pSpell); // nullptr may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
3927
3928 CurrentSpellTypes CSpellType = pSpell->GetCurrentContainer();
3929
3930 if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
3931 return;
3932
3933 bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
3934
3935 // break same type spell if it is not delayed
3936 InterruptSpell(CSpellType, false, true, bySelf);
3937
3938 // special breakage effects:
3939 switch (CSpellType)
3940 {
3942 {
3943 // generic spells always break channeled not delayed spells
3945 {
3946 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3947 {
3949 }
3950 }
3951
3952 // autorepeat breaking
3954 {
3955 // break autorepeat if not Auto Shot
3956 if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3958 m_AutoRepeatFirstCast = true;
3959 }
3960
3961 // melee spells breaking
3963 {
3964 // break melee spells if cast time
3965 if (pSpell->GetCastTime() > 0)
3966 {
3968 }
3969 }
3970 if (pSpell->GetCastTime() > 0)
3972
3973 break;
3974 }
3976 {
3977 // channel spells always break generic non-delayed and any channeled spells
3979 InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
3980
3981 // it also does break autorepeat if not Auto Shot
3983 m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75)
3986
3987 break;
3988 }
3990 {
3991 // only Auto Shoot does not break anything
3992 if (pSpell->m_spellInfo->Id != 75)
3993 {
3994 // generic autorepeats break generic non-delayed and channeled non-delayed spells
3996 {
3997 if (!s->GetSpellInfo()->IsActionAllowedChannel())
3998 {
4000 }
4001 }
4002
4004 }
4005 // special action: set first cast flag
4006 m_AutoRepeatFirstCast = true;
4007
4008 break;
4009 }
4010
4011 default:
4012 // other spell types don't break anything now
4013 break;
4014 }
4015
4016 // current spell (if it is still here) may be safely deleted now
4017 if (m_currentSpells[CSpellType])
4018 m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
4019
4020 // set new current spell
4021 m_currentSpells[CSpellType] = pSpell;
4022 pSpell->SetReferencedFromCurrent(true);
4023
4024 pSpell->m_selfContainer = &(m_currentSpells[pSpell->GetCurrentContainer()]);
4025}
CurrentSpellTypes GetCurrentContainer() const
Definition: Spell.cpp:7901
Spell ** m_selfContainer
Definition: Spell.h:610

References AddUnitState(), ASSERT, CURRENT_AUTOREPEAT_SPELL, CURRENT_CHANNELED_SPELL, CURRENT_GENERIC_SPELL, CURRENT_MELEE_SPELL, Spell::GetCastTime(), Spell::GetCurrentContainer(), GetCurrentSpell(), SpellInfo::Id, InterruptSpell(), m_AutoRepeatFirstCast, m_currentSpells, Spell::m_selfContainer, Spell::m_spellInfo, Spell::SetReferencedFromCurrent(), and UNIT_STATE_CASTING.

Referenced by Spell::prepare().

◆ setDeathState()

void Unit::setDeathState ( DeathState  s,
bool  despawn = false 
)
virtual

Reimplemented in Creature, Minion, Pet, and Player.

14480{
14481 // death state needs to be updated before RemoveAllAurasOnDeath() calls HandleChannelDeathItem(..) so that
14482 // it can be used to check creation of death items (such as soul shards).
14483
14484 if (s != DeathState::Alive && s != DeathState::JustRespawned)
14485 {
14486 CombatStop();
14489 ClearComboPointHolders(); // any combo points pointed to unit lost at it death
14490
14491 if (IsNonMeleeSpellCast(false))
14493
14494 UnsummonAllTotems(true);
14495 RemoveAllControlled(true);
14497 }
14498
14499 if (s == DeathState::JustDied)
14500 {
14501 // remove aurastates allowing special moves
14504
14505 GetMotionMaster()->Clear(false);
14507
14508 // Xinef: Remove Hover so the corpse can fall to the ground
14509 SetHover(false);
14510
14511 if (despawn)
14512 DisableSpline();
14513 else
14514 StopMoving();
14515
14516 // without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
14517 // do not why since in IncreaseMaxHealth currenthealth is checked
14518 SetHealth(0);
14519 SetPower(getPowerType(), 0);
14520
14521 // Stop emote on death
14523
14524 // players in instance don't have ZoneScript, but they have InstanceScript
14526 zoneScript->OnUnitDeath(this);
14527 }
14528 else if (s == DeathState::JustRespawned)
14529 {
14530 RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
14531 }
14532
14533 m_deathState = s;
14534}
@ UNIT_FLAG_SKINNABLE
Definition: UnitDefines.h:255
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
ZoneScript * GetZoneScript() const
Definition: Object.h:535
void ClearAllReactives()
Definition: Unit.cpp:16855
virtual bool SetHover(bool enable, bool packetOnly=false, bool updateAnimationTier=true)
Definition: Unit.cpp:20576
void ClearDiminishings()
Definition: Unit.h:672
Definition: ZoneScript.h:27

References MotionMaster::Clear(), ClearAllReactives(), ThreatMgr::ClearAllThreat(), ClearComboPointHolders(), ClearDiminishings(), CombatStop(), HostileRefMgr::deleteReferences(), DisableSpline(), getHostileRefMgr(), WorldObject::GetInstanceScript(), GetMotionMaster(), getPowerType(), GetThreatMgr(), WorldObject::GetZoneScript(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), m_deathState, MotionMaster::MoveIdle(), RemoveAllAurasOnDeath(), RemoveAllControlled(), Object::RemoveFlag(), SetHealth(), SetHover(), SetPower(), SetUInt32Value(), StopMoving(), UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE, UNIT_NPC_EMOTESTATE, and UnsummonAllTotems().

Referenced by _ExitVehicle(), KillMagnetEvent::Execute(), Spell::finish(), WorldSession::HandlePetActionHelper(), AuraEffect::HandleSpiritOfRedemption(), Kill(), Creature::setDeathState(), and Player::setDeathState().

◆ SetDisableGravity()

◆ SetDisplayId()

◆ SetExtraUnitMovementFlags()

void Unit::SetExtraUnitMovementFlags ( uint16  f)
inline

◆ SetFacingTo()

void Unit::SetFacingTo ( float  ori)
20431{
20432 Movement::MoveSplineInit init(this);
20433 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false);
20435 init.DisableTransportPathTransformations(); // It makes no sense to target global orientation
20436 init.SetFacing(ori);
20437 init.Launch();
20438}
ObjectGuid GetTransGUID() const override
Definition: Unit.cpp:18673

References Movement::MoveSplineInit::DisableTransportPathTransformations(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetTransGUID(), HasUnitMovementFlag(), Movement::MoveSplineInit::Launch(), MOVEMENTFLAG_ONTRANSPORT, Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_twinemperorsAI::DoAction(), npc_arthas::npc_arthasAI::DoAction(), Spell::EffectDistract(), UtherBatteredHiltEvent::Execute(), DistractMovementGenerator::Finalize(), Creature::FocusTarget(), spell_item_unusual_compass::HandleDummy(), spell_drakkari_colossus_face_me::HandleScriptEffect(), boss_grand_warlock_nethekurse::IntroRP(), npc_hyjal_jaina::hyjalJainaAI::IsSummonedBy(), boss_ragnaros::boss_ragnarosAI::JustDied(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::JustSummoned(), boss_nalorakk::MoveInLineOfSight(), boss_algalon_the_observer::boss_algalon_the_observerAI::MovementInform(), npc_brann_bronzebeard_algalon::npc_brann_bronzebeard_algalonAI::MovementInform(), boss_onyxia::MovementInform(), npc_twilight_volunteer::MovementInform(), boss_eadric::boss_eadricAI::MovementInform(), boss_paletress::boss_paletressAI::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_pos_deathwhisper_necrolyte::npc_pos_deathwhisper_necrolyteAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), boss_razorscale::boss_razorscaleAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), npc_commander_eligor_dawnbringer::npc_commander_eligor_dawnbringerAI::MovementInform(), boss_illidan_stormrage::boss_illidan_stormrageAI::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), boss_lady_vashj::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), boss_felmyst::boss_felmystAI::MovementInform(), boss_saviana_ragefire::boss_saviana_ragefireAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), npc_gunship_mage::npc_gunship_mageAI::MovementInform(), boss_the_lich_king::boss_the_lich_kingAI::MovementInform(), boss_skadi_grauf::boss_skadi_graufAI::MovementInform(), spell_lurker_below_spout::OnPeriodic(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), SmartAI::PausePath(), SmartScript::ProcessAction(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_nightbane::ScheduleFly(), Player::SetClientControl(), boss_grand_warlock_nethekurse::SetData(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), npc_chesspiece::SpellHitTarget(), boss_heigan::boss_heiganAI::StartFightPhase(), CreatureAI::TriggerAlert(), RotateMovementGenerator::Update(), boss_rend_blackhand::boss_rend_blackhandAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_medivh_bm::UpdateAI(), boss_onyxia::UpdateAI(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_pos_tyrannus_events::npc_pos_tyrannus_eventsAI::UpdateAI(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::UpdateAI(), boss_the_lich_king::boss_the_lich_kingAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_varos::boss_varosAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_warden_mellichar::npc_warden_mellicharAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), npc_general_andorov::UpdateEscortAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), npc_akama_illidan::npc_akama_illidanAI::UpdateEscortAI(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), npc_argent_soldier::npc_argent_soldierAI::WaypointReached(), npc_ranger_lilatha::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetFacingToObject()

void Unit::SetFacingToObject ( WorldObject object)
Todo:
figure out under what conditions creature will move towards object instead of facing it where it currently is.
20441{
20442 // never face when already moving
20443 if (!IsStopped())
20444 return;
20445
20447 Movement::MoveSplineInit init(this);
20448 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
20449 init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming
20450 init.Launch();
20451}
bool IsStopped() const
Definition: Unit.h:1609

References Position::GetAngle(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), IsStopped(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), and Movement::MoveSplineInit::SetFacing().

Referenced by boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), npc_ranshalla::npc_ranshallaAI::DoChannelTorchSpell(), spell_yogg_saron_target_selectors::HandleScript(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::IsSummonedBy(), npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy(), npc_wintergarde_gryphon::IsSummonedBy(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::JustSummoned(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), npc_drakuru_shackles::npc_drakuru_shacklesAI::LockRageclaw(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_hor_lich_king::npc_hor_lich_kingAI::MovementInform(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::MovementInform(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), npc_jungle_punch_target::npc_jungle_punch_targetAI::proceedCwEvent(), SmartScript::ProcessAction(), npc_lake_frog::npc_lake_frogAI::ReceiveEmote(), npc_dancing_flames::npc_dancing_flamesAI::ReceiveEmote(), npc_image_of_medivh::npc_image_of_medivhAI::Reset(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), boss_nightbane::ScheduleFly(), boss_razuvious::boss_razuviousAI::ScheduleInteractWithDeathKnight(), boss_the_lurker_below::SchedulerPhaseOne(), boss_shade_of_aran::SetGUID(), npc_bloodmage_laurith::npc_bloodmage_laurithAI::SetGUID(), npc_harrison_jones::npc_harrison_jonesAI::sGossipSelect(), npc_crusade_recruit::npc_crusade_recruitAI::sGossipSelect(), npc_forest_frog::npc_forest_frogAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), npc_magister_aledis::StartFight(), boss_hydross_the_unstable::SummonMovementInform(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), boss_victor_nefarius::boss_victor_nefariusAI::UpdateAI(), boss_majordomo::boss_majordomoAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_eastvale_peasent::UpdateAI(), npc_partygoer::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_winterfin_playmate::UpdateAI(), npc_snowfall_glade_playmate::UpdateAI(), npc_the_biggest_tree::UpdateAI(), npc_high_oracle_soo_roo::UpdateAI(), npc_the_etymidian::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_pilgrims_bounty_chair::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), boss_bronjahm::boss_bronjahmAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_rotface::boss_rotfaceAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), npc_ulduar_vx001::npc_ulduar_vx001AI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_hidden_cultist::npc_hidden_cultistAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI(), npc_ranshalla::npc_ranshallaAI::WaypointReached(), npc_arthas::npc_arthasAI::WaypointReached(), npc_scarlet_miner::npc_scarlet_minerAI::WaypointReached(), and npc_kaya_flathoof::npc_kaya_flathoofAI::WaypointReached().

◆ SetFaction()

void Unit::SetFaction ( uint32  faction)
9999{
10001 if (GetTypeId() == TYPEID_UNIT)
10003}
void UpdateMoveInLineOfSightState()
Definition: Creature.cpp:2583

References Object::GetTypeId(), SetUInt32Value(), Object::ToCreature(), TYPEID_UNIT, UNIT_FIELD_FACTIONTEMPLATE, and Creature::UpdateMoveInLineOfSightState().

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_hidden_cultist::npc_hidden_cultistAI::AttackPlayer(), GameObject::CastSpell(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::DestroyDoor(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), Spell::EffectSummonType(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::EnterEvadeMode(), BattlegroundEY::EventTeamCapturedPoint(), AuraEffect::HandleAuraModFaction(), BattlegroundIC::HandleCapturedNodes(), spell_q12096_q12092_dummy::HandleDummy(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), modify_commandscript::HandleModifyFactionCommand(), npc_commandscript::HandleNpcSetFactionIdCommand(), npc_commandscript::HandleNpcSetFactionTempIdCommand(), spell_mutate_explode_bug::HandleOnHit(), spell_q10612_10613_the_fel_and_the_furious::HandleScriptEffect(), spell_item_draenic_pale_ale::HandleSummon(), npc_cork_gizelton::npc_cork_gizeltonAI::ImmuneFlagSet(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_general_andorov::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), Minion::InitStats(), TempSummon::InitStats(), InitTamedPet(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), npc_enraged_spirit::npc_enraged_spiritAI::JustDied(), FollowerAI::JustRespawned(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_volkhan::boss_volkhanAI::JustSummoned(), npc_creature_generator_akama::JustSummoned(), boss_balinda::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), Pet::LoadPetFromDB(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), boss_twilight_corrupter::MoveInLineOfSight(), npc_akama_shade::MovementInform(), BattlegroundAB::NodeOccupied(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), spell_brewfest_reveler_transform::OnApply(), npc_chesspiece::OnCharmed(), BattlefieldWG::OnCreatureCreate(), instance_blackrock_depths::instance_blackrock_depths_InstanceMapScript::OnCreatureCreate(), instance_nexus::instance_nexus_InstanceMapScript::OnCreatureCreate(), instance_black_temple::instance_black_temple_InstanceMapScript::OnCreatureCreate(), boss_azuregos::OnGossipSelect(), npc_prospector_remtravel::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_lakota_windsong::OnQuestAccept(), npc_paoka_swiftmountain::OnQuestAccept(), npc_engineer_helice::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_maxx_a_million_escort::OnQuestAccept(), npc_kaya_flathoof::OnQuestAccept(), npc_wizzlecrank_shredder::OnQuestAccept(), npc_ame::OnQuestAccept(), npc_ranshalla::OnQuestAccept(), npc_lurgglbr::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_apothecary_hanes::OnQuestAccept(), npc_bessy::OnQuestAccept(), npc_isla_starmane::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::PassengerBoarded(), npc_frosthound::npc_frosthoundAI::PassengerBoarded(), BattlegroundAV::PopulateNode(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), RemoveCharmedBy(), boss_doomrel::boss_doomrelAI::Reset(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_coren_direbrew::Reset(), npc_direbrew_minion::Reset(), npc_aquementas::npc_aquementasAI::Reset(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::Reset(), npc_plucky::npc_pluckyAI::Reset(), boss_grobbulus_poison_cloud::boss_grobbulus_poison_cloudAI::Reset(), brann_bronzebeard::brann_bronzebeardAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), npc_captured_rageclaw::npc_captured_rageclawAI::Reset(), npc_akama_shade::Reset(), npc_aeranas::npc_aeranasAI::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), npc_chicken_cluck::npc_chicken_cluckAI::Reset(), RestoreFaction(), SetCharmedBy(), Player::SetFactionForRace(), Player::SetGameMaster(), npc_captain_saeed::npc_captain_saeedAI::SetGUID(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), BattlegroundIC::SetupBattleground(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::SpawnCreature(), npc_captured_rageclaw::npc_captured_rageclawAI::SpellHit(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::SpellHit(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::SpellHit(), npc_crusade_persuaded::npc_crusade_persuadedAI::SpellHit(), npc_enslaved_netherwing_drake::SpellHit(), npc_belnistrasz::npc_belnistraszAI::sQuestAccept(), npc_professor_phizzlethorpe::npc_professor_phizzlethorpeAI::sQuestAccept(), npc_ranger_lilatha::sQuestAccept(), npc_corporal_keeshan::npc_corporal_keeshanAI::sQuestAccept(), npc_muglash::npc_muglashAI::sQuestAccept(), npc_wounded_blood_elf::npc_wounded_blood_elfAI::sQuestAccept(), FollowerAI::StartFollow(), pyrewood_ambush::pyrewood_ambushAI::SummonCreatureWithRandomTarget(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), Spell::SummonGuardian(), Player::SummonPet(), npc_artruis_the_hearthless::npc_artruis_the_hearthlessAI::SummonsAction(), WorldObject::SummonTrigger(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), npc_death_knight_initiate::npc_death_knight_initiateAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_aquementas::npc_aquementasAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), npc_sergeant_bly::npc_sergeant_blyAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_magister_aledis::UpdateAI(), npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI::UpdateAI(), Creature::UpdateEntry(), npc_magwin::npc_magwinAI::UpdateEscortAI(), and npc_tapoke_slim_jahn::npc_tapoke_slim_jahnAI::WaypointReached().

◆ SetFeared()

void Unit::SetFeared ( bool  apply,
Unit fearedBy = nullptr,
bool  isFear = false 
)
protected
18204{
18205 if (apply)
18206 {
18207 SetTarget();
18208 GetMotionMaster()->MoveFleeing(fearedBy, isFear ? 0 : sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY));
18209 }
18210 else
18211 {
18212 if (IsAlive())
18213 {
18214 if (GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == FLEEING_MOTION_TYPE)
18215 {
18217 StopMoving();
18218 }
18219
18220 if (GetVictim())
18222 }
18223 }
18224
18225 // xinef: block / allow control to real mover (eg. charmer)
18226 if (IsPlayer())
18227 {
18228 if (m_movedByPlayer)
18229 m_movedByPlayer->ToPlayer()->SetClientControl(this, !apply); // verified
18230 //else
18231 // ToPlayer()->SetClientControl(this, !apply);
18232 }
18233}
@ FLEEING_MOTION_TYPE
Definition: MotionMaster.h:47
@ CONFIG_CREATURE_FAMILY_FLEE_DELAY
Definition: IWorld.h:289
void MoveFleeing(Unit *enemy, uint32 time=0)
Enable the target's fleeing movement. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition: MotionMaster.cpp:743

References CONFIG_CREATURE_FAMILY_FLEE_DELAY, FLEEING_MOTION_TYPE, Object::GetGUID(), GetMotionMaster(), GetVictim(), IsAlive(), Object::IsPlayer(), m_movedByPlayer, MOTION_SLOT_CONTROLLED, MotionMaster::MoveFleeing(), MotionMaster::MovementExpired(), Player::SetClientControl(), SetTarget(), StopMoving(), sWorld, and Object::ToPlayer().

Referenced by SetControlled().

◆ SetFeatherFall()

bool Unit::SetFeatherFall ( bool  enable,
bool  packetOnly = false 
)
virtual

Reimplemented in Player, and Creature.

20555{
20557 return false;
20558
20559 if (enable)
20561 else
20563
20564 return true;
20565}
@ MOVEMENTFLAG_FALLING_SLOW
Definition: UnitDefines.h:373

References AddUnitMovementFlag(), HasUnitMovementFlag(), MOVEMENTFLAG_FALLING_SLOW, and RemoveUnitMovementFlag().

Referenced by AuraEffect::HandleAuraFeatherFall(), debug_commandscript::HandleDebugMoveflagsCommand(), Player::SetFeatherFall(), and Creature::SetFeatherFall().

◆ SetFullHealth()

◆ SetHealth()

void Unit::SetHealth ( uint32  val)
15406{
15407 if (getDeathState() == DeathState::JustDied)
15408 val = 0;
15409 else if (IsPlayer() && getDeathState() == DeathState::Dead)
15410 val = 1;
15411 else
15412 {
15413 uint32 maxHealth = GetMaxHealth();
15414 if (maxHealth < val)
15415 val = maxHealth;
15416 }
15417
15418 float prevHealthPct = GetHealthPct();
15419
15421
15422 // mobs that are now or were below 30% need to update their speed
15423 if (GetTypeId() == TYPEID_UNIT && !(IsPet() && ToPet()->isControlled() && IsControlledByPlayer()) && (prevHealthPct < 30.0 || HealthBelowPct(30)))
15424 {
15425 UpdateSpeed(MOVE_RUN, false);
15426 }
15427
15428 // group update
15429 if (IsPlayer())
15430 {
15431 Player* player = ToPlayer();
15432 if (player->NeedSendSpectatorData())
15434
15435 if (player->GetGroup())
15437 }
15438 else if (Pet* pet = ToCreature()->ToPet())
15439 {
15440 if (pet->isControlled())
15441 {
15442 if (Unit* owner = GetOwner())
15443 if (Player* player = owner->ToPlayer())
15444 {
15445 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
15446 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
15447
15448 if (player->GetGroup())
15450 }
15451 }
15452 }
15453}
@ GROUP_UPDATE_FLAG_CUR_HP
Definition: Group.h:101
@ GROUP_UPDATE_FLAG_PET_CUR_HP
Definition: Group.h:113
void SendCommand_UInt32Value(T *o, ObjectGuid targetGUID, const char *prefix, uint32 t)
Definition: ArenaSpectator.h:62
bool NeedSendSpectatorData() const
Definition: Player.cpp:15350
void SetGroupUpdateFlag(uint32 flag)
Definition: Player.h:2450
float GetHealthPct() const
Definition: Unit.h:790

References WorldObject::FindMap(), getDeathState(), Player::GetGroup(), Object::GetGUID(), GetHealthPct(), GetMaxHealth(), GetOwner(), Object::GetTypeId(), GROUP_UPDATE_FLAG_CUR_HP, GROUP_UPDATE_FLAG_PET_CUR_HP, HealthBelowPct(), IsControlledByPlayer(), IsPet(), Object::IsPlayer(), MOVE_RUN, Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), TYPEID_UNIT, UNIT_FIELD_HEALTH, and UpdateSpeed().

Referenced by boss_twilight_halion::boss_twilight_halionAI::boss_twilight_halionAI(), Player::BuildPlayerRepop(), npc_mograine::npc_mograineAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), boss_viscidus::DamageTaken(), boss_thorim_start_npcs::boss_thorim_start_npcsAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DamageTaken(), DealDamage(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_terenas_menethil::npc_terenas_menethilAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_thaddius_summon::boss_thaddius_summonAI::DoAction(), boss_xt002::boss_xt002AI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), Spell::EffectResurrectPet(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Spell::EffectSummonType(), boss_prince_keleseth_icc::boss_prince_kelesethAI::EnterEvadeMode(), boss_prince_taldaram_icc::boss_prince_taldaramAI::EnterEvadeMode(), boss_prince_valanar_icc::boss_prince_valanarAI::EnterEvadeMode(), boss_halazzi::EnterPhase(), AuraEffect::HandleAuraModIncreaseHealth(), AuraEffect::HandleAuraModIncreaseHealthPercent(), AuraEffect::HandleAuraModIncreaseMaxHealth(), spell_oculus_soar_aura::HandleEffectPeriodic(), modify_commandscript::HandleModifyHPCommand(), AuraEffect::HandleModTotalPercentStat(), npc_commandscript::HandleNpcSetLevelCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), npc_echo_of_medivh::HandlePieceJustDied(), spell_stinky_precious_decimate::HandleScript(), spell_ahune_synch_health::HandleScript(), AuraEffect::HandleSpiritOfRedemption(), npc_pet_pri_lightwell::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustReachedHome(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustReachedHome(), boss_prince_valanar_icc::boss_prince_valanarAI::JustReachedHome(), npc_dirt_mound::JustSummoned(), boss_skeram::JustSummoned(), boss_attumen::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyHealth(), boss_grand_champion::boss_grand_championAI::MovementInform(), npc_nether_drake::npc_nether_drakeAI::MovementInform(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), instance_karazhan::instance_karazhan_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), Player::ProcessDelayedOperations(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), boss_prince_keleseth_icc::boss_prince_kelesethAI::Reset(), boss_prince_taldaram_icc::boss_prince_taldaramAI::Reset(), boss_prince_valanar_icc::boss_prince_valanarAI::Reset(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::Reset(), boss_murmur::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetAllPowers(), Player::RestoreHealthAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetFullHealth(), SetMaxHealth(), boss_headless_horseman::SpellHit(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), boss_malchezaar::SpellHitTarget(), npc_giant_claw_tentacle::Submerge(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), boss_garfrost::boss_garfrostAI::UpdateAI(), boss_ick::boss_ickAI::UpdateAI(), boss_tyrannus::boss_tyrannusAI::UpdateAI(), boss_prince_valanar_icc::boss_prince_valanarAI::UpdateAI(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::UpdateAI(), Creature::UpdateEntry(), and boss_twin_valkyrAI::UpdateSharedHealth().

◆ SetHover()

bool Unit::SetHover ( bool  enable,
bool  packetOnly = false,
bool  updateAnimationTier = true 
)
virtual

Reimplemented in Creature, and Player.

20577{
20579 return false;
20580
20581 float hoverHeight = GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
20582
20583 if (enable)
20584 {
20586 if (hoverHeight && GetPositionZ() - GetFloorZ() < hoverHeight)
20587 UpdateHeight(GetPositionZ() + hoverHeight);
20588 }
20589 else
20590 {
20592 if (hoverHeight && (!isDying() || GetTypeId() != TYPEID_UNIT))
20593 {
20594 float newZ = std::max<float>(GetFloorZ(), GetPositionZ() - hoverHeight);
20596 UpdateHeight(newZ);
20597 }
20598 SendMovementFlagUpdate(); // pussywizard: needed for falling after death (instead of falling onto air at hover height)
20599 }
20600
20601 return true;
20602}
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition: Object.cpp:1554
float GetFloorZ() const
Definition: Object.cpp:3130
void UpdateHeight(float newZ)
Only server-side height update, does not broadcast to client.
Definition: Unit.cpp:19990
void SendMovementFlagUpdate(bool self=false)
Definition: Unit.cpp:16632

References AddUnitMovementFlag(), Object::GetFloatValue(), WorldObject::GetFloorZ(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), HasUnitMovementFlag(), isDying(), MOVEMENTFLAG_HOVER, RemoveUnitMovementFlag(), SendMovementFlagUpdate(), TYPEID_UNIT, UNIT_FIELD_HOVERHEIGHT, WorldObject::UpdateAllowedPositionZ(), and UpdateHeight().

Referenced by AuraEffect::HandleAuraHover(), debug_commandscript::HandleDebugMoveflagsCommand(), setDeathState(), Creature::SetHover(), and Player::SetHover().

◆ SetImmuneToAll()

void Unit::SetImmuneToAll ( bool  apply,
bool  keepCombat = false 
)
inline
1022{ SetImmuneToPC(apply, keepCombat); SetImmuneToNPC(apply, keepCombat); }
void SetImmuneToNPC(bool apply, bool keepCombat=false)
Definition: Unit.cpp:13551

References SetImmuneToNPC(), and SetImmuneToPC().

Referenced by spell_the_lich_king_trigger_vile_spirit::ActivateSpirit(), boss_chromaggus::boss_chromaggusAI::boss_chromaggusAI(), boss_nalorakk::boss_nalorakk(), boss_felblood_kaelthas::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_warden_mellichar::npc_warden_mellicharAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_taldaram::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), npc_living_constellation::npc_living_constellationAI::DoAction(), boss_broggok::DoAction(), boss_grand_warlock_nethekurse::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_ambassador_hellmaw::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), boss_skeram::DoTeleport(), Spell::EffectSummonType(), npc_ghostly_priest::npc_ghostly_priestAI::EnterEvadeMode(), npc_phantom_mage::npc_phantom_mageAI::EnterEvadeMode(), npc_shadowy_mercenary::npc_shadowy_mercenaryAI::EnterEvadeMode(), npc_spectral_footman::npc_spectral_footmanAI::EnterEvadeMode(), npc_tortured_rifleman::npc_tortured_riflemanAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::HandleEffectApply(), spell_uldaman_stoned::spell_uldaman_stoned_AuraScript::HandleEffectRemove(), spell_q11919_q11940_drake_hunt_aura::HandleEffectRemove(), spell_item_draenic_pale_ale::HandleSummon(), boss_majordomo::boss_majordomoAI::InitializeAI(), boss_felblood_kaelthas::InitializeAI(), boss_captain_skarloc::InitializeAI(), boss_taldaram::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::InitializeAI(), boss_prince_taldaram_icc::boss_prince_taldaramAI::InitializeAI(), boss_prince_valanar_icc::boss_prince_valanarAI::InitializeAI(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), npc_lord_arete::npc_lord_areteAI::InitializeAI(), boss_ambassador_hellmaw::InitializeAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::InitializeAI(), Player::InitStatsForLevel(), boss_falric::boss_falricAI::JustEngagedWith(), boss_marwyn::boss_marwynAI::JustEngagedWith(), boss_moroes::JustEngagedWith(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), npc_rinji::npc_rinjiAI::JustRespawned(), npc_isla_starmane::npc_isla_starmaneAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), boss_skeram::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), boss_captain_skarloc::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_dkc1_gothik::npc_dkc1_gothikAI::MoveInLineOfSight(), boss_nalorakk::MoveInLineOfSight(), boss_captain_skarloc::MovementInform(), boss_taldaram::MovementInform(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_sister_svalna::boss_sister_svalnaAI::MovementInform(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MovementInform(), npc_enslaved_proto_drake::npc_enslaved_proto_drakeAI::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), npc_memory::npc_memoryAI::npc_memoryAI(), npc_rinji::npc_rinjiAI::npc_rinjiAI(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::npc_scarlet_miner_cartAI(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_ragnaros::boss_ragnarosAI::Reset(), boss_felblood_kaelthas::Reset(), boss_mandokir::boss_mandokirAI::Reset(), boss_skeram::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), boss_falric::boss_falricAI::Reset(), boss_marwyn::boss_marwynAI::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_sister_svalna::boss_sister_svalnaAI::Reset(), boss_svala::boss_svalaAI::Reset(), npc_thassarian::npc_thassarianAI::Reset(), boss_ambassador_hellmaw::Reset(), boss_illidan_stormrage::boss_illidan_stormrageAI::Reset(), boss_broggok::Reset(), boss_grand_warlock_nethekurse::Reset(), npc_warden_mellichar::npc_warden_mellicharAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_svala::boss_svalaAI::SetData(), npc_blackhand_incarcerator::npc_blackhand_incarceratorAI::SetData(), boss_chromaggus::boss_chromaggusAI::SetGUID(), boss_black_knight::boss_black_knightAI::SpellHitTarget(), npc_rinji::npc_rinjiAI::sQuestAccept(), boss_majordomo::boss_majordomoAI::SummonedCreatureDies(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_felblood_kaelthas::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), boss_mandokir::boss_mandokirAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_skeram::UpdateAI(), npc_memory::npc_memoryAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), npc_crok_scourgebane::npc_crok_scourgebaneAI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_anzu::UpdateAI(), npc_millhouse_manastorm::npc_millhouse_manastormAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), and npc_franklin::npc_franklinAI::UpdateAI().

◆ SetImmuneToNPC()

void Unit::SetImmuneToNPC ( bool  apply,
bool  keepCombat = false 
)

◆ SetImmuneToPC()

void Unit::SetImmuneToPC ( bool  apply,
bool  keepCombat = false 
)
13543{
13544 (void)keepCombat;
13545 if (apply)
13547 else
13549}

References RemoveUnitFlag(), SetUnitFlag(), and UNIT_FLAG_IMMUNE_TO_PC.

Referenced by boss_victor_nefarius::boss_victor_nefariusAI::BeginEvent(), boss_the_lich_king::boss_the_lich_kingAI::boss_the_lich_kingAI(), ClearInCombat(), npc_magister_aledis::DamageTaken(), boss_dorothee::DoAction(), boss_roar::DoAction(), boss_strawman::DoAction(), boss_tinhead::DoAction(), boss_apothecary_hummel::boss_apothecary_hummelAI::DoAction(), npc_apothecary_genericAI::DoAction(), npc_coren_direbrew::DoAction(), npc_direbrew_antagonist::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_frozen_core::DoAction(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectApply(), spell_q11396_11399_force_shield_arcane_purple_x3::HandleEffectRemove(), boss_blackheart_the_inciter::JustEngagedWith(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::JustSummoned(), npc_spinestalker::npc_spinestalkerAI::MovementInform(), npc_rimefang::npc_rimefangAI::MovementInform(), npc_omen::npc_omenAI::MovementInform(), npc_omen::npc_omenAI::npc_omenAI(), npc_death_knight_initiate::OnGossipSelect(), instance_ulduar::instance_ulduar_InstanceMapScript::OnPlayerEnter(), npc_kaya_flathoof::OnQuestAccept(), boss_doomrel::boss_doomrelAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_julianne::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_a_special_surprise::npc_a_special_surpriseAI::Reset(), npc_coren_direbrew::Reset(), boss_general_zarithrian::boss_general_zarithrianAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), boss_gothik::boss_gothikAI::Reset(), boss_algalon_the_observer::boss_algalon_the_observerAI::Reset(), npc_venture_co_straggler::npc_venture_co_stragglerAI::Reset(), boss_blackheart_the_inciter::Reset(), boss_magtheridon::Reset(), npc_magister_aledis::Reset(), boss_magtheridon::ScheduleCombatEvents(), SetImmuneToAll(), SetInCombatState(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_infernal_attacker::npc_infernal_attackerAI::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::UpdateAI(), npc_unworthy_initiate::npc_unworthy_initiateAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), boss_gothik::boss_gothikAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_magister_aledis::UpdateAI(), and npc_tallhorn_stag::npc_tallhorn_stagAI::UpdateAI().

◆ SetInCombatState()

void Unit::SetInCombatState ( bool  PvP,
Unit enemy = nullptr,
uint32  duration = 0 
)
13664{
13665 // only alive units can be in combat
13666 if (!IsAlive())
13667 return;
13668
13669 if (PvP)
13670 m_CombatTimer = std::max<uint32>(GetCombatTimer(), std::max<uint32>(5500, duration));
13671 else if (duration)
13672 m_CombatTimer = std::max<uint32>(GetCombatTimer(), duration);
13673
13675 return;
13676
13677 // xinef: if we somehow engage in combat (scripts, dunno) with player, remove this flag so he can fight back
13679 SetImmuneToPC(false); // unit has engaged in combat, remove immunity so players can fight back
13680
13681 if (IsInCombat())
13682 return;
13683
13685
13686 if (Creature* creature = ToCreature())
13687 {
13688 // Set home position at place of engaging combat for escorted creatures
13689 if ((IsAIEnabled && creature->AI()->IsEscorted()) ||
13690 GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE ||
13691 GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
13692 creature->SetHomePosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
13693
13694 if (enemy)
13695 {
13696 if (IsAIEnabled)
13697 creature->AI()->JustEngagedWith(enemy);
13698
13699 if (creature->GetFormation())
13700 creature->GetFormation()->MemberEngagingTarget(creature, enemy);
13701
13702 sScriptMgr->OnUnitEnterCombat(creature, enemy);
13703 }
13704
13705 creature->RefreshSwimmingFlag();
13706
13707 if (IsPet())
13708 {
13709 UpdateSpeed(MOVE_RUN, true);
13710 UpdateSpeed(MOVE_SWIM, true);
13711 UpdateSpeed(MOVE_FLIGHT, true);
13712 }
13713
13714 if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT))
13715 Dismount();
13716 if (!IsStandState()) // pussywizard: already done in CombatStart(target, initialAggro) for the target, but when aggro'ing from MoveInLOS CombatStart is not called!
13718 }
13719
13720 for (Unit::ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
13721 {
13722 Unit* controlled = *itr;
13723 ++itr;
13724
13725 // Xinef: Dont set combat for passive units, they will evade in next update...
13726 if (controlled->GetTypeId() == TYPEID_UNIT && controlled->ToCreature()->HasReactState(REACT_PASSIVE))
13727 continue;
13728
13729 controlled->SetInCombatState(PvP, enemy, duration);
13730 }
13731
13732 if (Player* player = this->ToPlayer())
13733 {
13734 sScriptMgr->OnPlayerEnterCombat(player, enemy);
13735 }
13736}
@ MOVE_FLIGHT
Definition: UnitDefines.h:334
@ MOVE_SWIM
Definition: UnitDefines.h:331
@ ESCORT_MOTION_TYPE
Definition: MotionMaster.h:55
@ WAYPOINT_MOTION_TYPE
Definition: MotionMaster.h:39
@ CREATURE_TYPE_NON_COMBAT_PET
Definition: SharedDefines.h:2639
@ CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT
Definition: SharedDefines.h:2706
bool HasReactState(ReactStates state) const
Definition: Creature.h:99
uint32 GetCombatTimer() const
Definition: Unit.h:1042
void SetInCombatState(bool PvP, Unit *enemy=nullptr, uint32 duration=0)
Definition: Unit.cpp:13663
bool IsStandState() const
Definition: Unit.cpp:16648

References CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT, CREATURE_TYPE_NON_COMBAT_PET, Dismount(), ESCORT_MOTION_TYPE, GetCharmerOrOwnerPlayerOrPlayerItself(), GetCombatTimer(), GetCreatureType(), GetMotionMaster(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::GetTypeId(), Creature::HasReactState(), HasUnitState(), IsAIEnabled, IsAlive(), IsImmuneToPC(), IsInCombat(), IsPet(), IsStandState(), m_CombatTimer, m_Controlled, MOVE_FLIGHT, MOVE_RUN, MOVE_SWIM, REACT_PASSIVE, SetImmuneToPC(), SetInCombatState(), SetStandState(), SetUnitFlag(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_UNIT, UNIT_FLAG_IN_COMBAT, UNIT_STAND_STATE_STAND, UNIT_STATE_EVADE, UpdateSpeed(), and WAYPOINT_MOTION_TYPE.

Referenced by Spell::DoSpellHitOnUnit(), SetInCombatState(), and SetInCombatWith().

◆ SetInCombatWith()

void Unit::SetInCombatWith ( Unit enemy,
uint32  duration = 0 
)
13517{
13518 // Xinef: Dont allow to start combat with triggers
13519 if (enemy->GetTypeId() == TYPEID_UNIT && enemy->ToCreature()->IsTrigger())
13520 return;
13521
13522 Unit* eOwner = enemy->GetCharmerOrOwnerOrSelf();
13523 if (eOwner->IsPvP() || eOwner->IsFFAPvP())
13524 {
13525 SetInCombatState(true, enemy, duration);
13526 return;
13527 }
13528
13529 // check for duel
13530 if (eOwner->IsPlayer() && eOwner->ToPlayer()->duel)
13531 {
13532 Unit const* myOwner = GetCharmerOrOwnerOrSelf();
13533 if (((Player const*)eOwner)->duel->Opponent == myOwner)
13534 {
13535 SetInCombatState(true, enemy, duration);
13536 return;
13537 }
13538 }
13539 SetInCombatState(false, enemy, duration);
13540}

References Player::duel, GetCharmerOrOwnerOrSelf(), Object::GetTypeId(), IsFFAPvP(), Object::IsPlayer(), IsPvP(), Creature::IsTrigger(), SetInCombatState(), Object::ToCreature(), Object::ToPlayer(), and TYPEID_UNIT.

Referenced by Attack(), npc_daphne_stilwell::npc_daphne_stilwellAI::AttackStart(), CombatStart(), CombatStartOnCast(), npc_centrifuge_construct::npc_centrifuge_constructAI::DamageTaken(), Spell::DoAllEffectOnTarget(), CreatureAI::DoZoneInCombat(), boss_sapphiron::boss_sapphironAI::EnterCombatSelfFunction(), spell_herald_volzaj_insanity::HandleDummyEffect(), boss_chromaggus::boss_chromaggusAI::PathEndReached(), SmartScript::ProcessAction(), npc_high_overlord_saurfang_igb::npc_high_overlord_saurfang_igbAI::UpdateAI(), npc_muradin_bronzebeard_igb::npc_muradin_bronzebeard_igbAI::UpdateAI(), npc_gunship_boarding_addAI::UpdateAI(), and npc_gunship_gunner::npc_gunship_gunnerAI::UpdateAI().

◆ SetInFront()

◆ SetInstantCast()

void Unit::SetInstantCast ( bool  set)
inline
1779{ _instantCast = set; }

References _instantCast.

Referenced by AuraEffect::HandleModCastingSpeed().

◆ SetLastDamagedTargetGuid()

void Unit::SetLastDamagedTargetGuid ( ObjectGuid const &  guid)
inline

◆ SetLastExtraAttackSpell()

void Unit::SetLastExtraAttackSpell ( uint32  spellId)
inline
914{ _lastExtraAttackSpell = spellId; }

References _lastExtraAttackSpell.

Referenced by Spell::_handle_finish_phase().

◆ SetLastManaUse()

void Unit::SetLastManaUse ( uint32  spellCastTime)
inline
1560{ m_lastManaUse = spellCastTime; }

References m_lastManaUse.

Referenced by Spell::TakePower().

◆ SetLevel()

void Unit::SetLevel ( uint8  lvl,
bool  showLevelChange = true 
)

◆ SetMaxHealth()

void Unit::SetMaxHealth ( uint32  val)
15456{
15457 if (!val)
15458 val = 1;
15459
15460 uint32 health = GetHealth();
15462
15463 // group update
15464 if (IsPlayer())
15465 {
15466 Player* player = ToPlayer();
15467 if (player->NeedSendSpectatorData())
15469
15470 if (player->GetGroup())
15472 }
15473 else if (Pet* pet = ToCreature()->ToPet())
15474 {
15475 if (pet->isControlled())
15476 {
15477 if (Unit* owner = GetOwner())
15478 if (Player* player = owner->ToPlayer())
15479 {
15480 if (player->NeedSendSpectatorData() && pet->GetCreatureTemplate()->family)
15481 ArenaSpectator::SendCommand_UInt32Value(player->FindMap(), player->GetGUID(), "PHP", (uint32)pet->GetHealthPct());
15482
15483 if (player->GetGroup())
15485 }
15486 }
15487 }
15488
15489 if (val < health)
15490 SetHealth(val);
15491}
@ GROUP_UPDATE_FLAG_MAX_HP
Definition: Group.h:102
@ GROUP_UPDATE_FLAG_PET_MAX_HP
Definition: Group.h:114

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetHealth(), GetOwner(), GROUP_UPDATE_FLAG_MAX_HP, GROUP_UPDATE_FLAG_PET_MAX_HP, Object::IsPlayer(), Player::NeedSendSpectatorData(), ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetHealth(), SetUInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXHEALTH.

Referenced by boss_xt002::boss_xt002AI::DoAction(), Spell::EffectSummonType(), boss_halazzi::EnterPhase(), modify_commandscript::HandleModifyHPCommand(), npc_commandscript::HandleNpcSetLevelCommand(), npc_pet_pri_lightwell::InitializeAI(), Player::InitStatsForLevel(), boss_skeram::JustSummoned(), npc_corrupted_totem::npc_corrupted_totem(), npc_xt002_life_spark::npc_xt002_life_sparkAI::npc_xt002_life_sparkAI(), Creature::SelectLevel(), boss_akilzon::boss_akilzonAI::UpdateAI(), npc_pet_hunter_snake_trap::UpdateAI(), Creature::UpdateMaxHealth(), Guardian::UpdateMaxHealth(), and Player::UpdateMaxHealth().

◆ SetMaxPower()

void Unit::SetMaxPower ( Powers  power,
uint32  val 
)
15559{
15560 uint32 cur_power = GetPower(power);
15561 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_MAXPOWER1) + power, val);
15562
15563 // group update
15564 if (IsPlayer())
15565 {
15566 Player* player = ToPlayer();
15567 if (getPowerType() == power && player->NeedSendSpectatorData())
15568 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
15569
15570 if (player->GetGroup())
15572 }
15573 else if (Pet* pet = ToCreature()->ToPet())
15574 {
15575 if (pet->isControlled())
15576 {
15577 Unit* owner = GetOwner();
15578 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
15580 }
15581 }
15582
15583 if (val < cur_power)
15584 SetPower(power, val);
15585}
@ GROUP_UPDATE_FLAG_PET_MAX_POWER
Definition: Group.h:117
@ GROUP_UPDATE_FLAG_MAX_POWER
Definition: Group.h:105
void SetStatInt32Value(uint16 index, int32 value)
Definition: Object.cpp:798

References WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetOwner(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_MAX_POWER, GROUP_UPDATE_FLAG_PET_MAX_POWER, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Player::SetGroupUpdateFlag(), SetPower(), Object::SetStatInt32Value(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_MAXPOWER1.

Referenced by Player::Create(), Pet::CreateBaseAtTamed(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Pet::LoadPetFromDB(), Creature::SelectLevel(), setPowerType(), Creature::UpdateMaxPower(), Guardian::UpdateMaxPower(), and Player::UpdateMaxPower().

◆ SetMinion()

void Unit::SetMinion ( Minion minion,
bool  apply 
)
10621{
10622 LOG_DEBUG("entities.unit", "SetMinion {} for {}, apply {}", minion->GetEntry(), GetEntry(), apply);
10623
10624 if (apply)
10625 {
10626 if (minion->GetOwnerGUID())
10627 {
10628 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
10629 return;
10630 }
10631
10632 minion->SetOwnerGUID(GetGUID());
10633
10634 m_Controlled.insert(minion);
10635
10636 if (IsPlayer())
10637 {
10638 minion->m_ControlledByPlayer = true;
10640 }
10641
10642 // Can only have one pet. If a new one is summoned, dismiss the old one.
10643 if (minion->IsGuardianPet())
10644 {
10645 if (Guardian* oldPet = GetGuardianPet())
10646 {
10647 if (oldPet != minion && (oldPet->IsPet() || minion->IsPet() || oldPet->GetEntry() != minion->GetEntry()))
10648 {
10649 // remove existing minion pet
10650 if (Pet* oldPetAsPet = oldPet->ToPet())
10651 {
10652 oldPetAsPet->Remove(PET_SAVE_NOT_IN_SLOT);
10653 }
10654 else
10655 {
10656 oldPet->UnSummon();
10657 }
10658
10659 SetPetGUID(minion->GetGUID());
10661 }
10662 }
10663 else
10664 {
10665 SetPetGUID(minion->GetGUID());
10667 }
10668 }
10669
10671 {
10673 }
10674
10675 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
10676 {
10677 SetCritterGUID(minion->GetGUID());
10678 }
10679
10680 // PvP, FFAPvP
10682
10683 // Ghoul pets have energy instead of mana (is anywhere better place for this code?)
10684 if (minion->IsPetGhoul() || minion->GetEntry() == 24207 /*ENTRY_ARMY_OF_THE_DEAD*/)
10685 minion->setPowerType(POWER_ENERGY);
10686
10687 if (IsPlayer())
10688 {
10689 // Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
10690 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
10691
10692 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
10693 ToPlayer()->AddSpellAndCategoryCooldowns(spellInfo, 0, nullptr, true);
10694 }
10695 }
10696 else
10697 {
10698 if (minion->GetOwnerGUID() != GetGUID())
10699 {
10700 LOG_FATAL("entities.unit", "SetMinion: Minion {} is not the minion of owner {}", minion->GetEntry(), GetEntry());
10701 return;
10702 }
10703
10704 m_Controlled.erase(minion);
10705
10706 if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
10707 {
10708 if (GetCritterGUID() == minion->GetGUID())
10710 }
10711
10712 if (minion->IsGuardianPet())
10713 {
10714 if (GetPetGUID() == minion->GetGUID())
10716 }
10717 else if (minion->IsTotem())
10718 {
10719 // All summoned by totem minions must disappear when it is removed.
10720 if (SpellInfo const* spInfo = sSpellMgr->GetSpellInfo(minion->ToTotem()->GetSpell()))
10721 {
10722 for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
10723 {
10724 if (spInfo->Effects[i].Effect != SPELL_EFFECT_SUMMON)
10725 continue;
10726
10727 RemoveAllMinionsByEntry(spInfo->Effects[i].MiscValue);
10728 }
10729 }
10730 }
10731
10732 if (IsPlayer())
10733 {
10734 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(minion->GetUInt32Value(UNIT_CREATED_BY_SPELL));
10735 // Remove infinity cooldown
10736 if (spellInfo && spellInfo->IsCooldownStartedOnEvent())
10737 ToPlayer()->SendCooldownEvent(spellInfo);
10738
10739 // xinef: clear spell book
10740 if (m_Controlled.empty())
10742 }
10743
10744 //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN))
10745 {
10747 {
10748 // Check if there is another minion
10749 for (ControlSet::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
10750 {
10751 // do not use this check, creature do not have charm guid
10752 //if (GetCharmGUID() == (*itr)->GetGUID())
10753 if (GetGUID() == (*itr)->GetCharmerGUID())
10754 continue;
10755
10756 //ASSERT((*itr)->GetOwnerGUID() == GetGUID());
10757 if ((*itr)->GetOwnerGUID() != GetGUID())
10758 {
10759 OutDebugInfo();
10760 (*itr)->OutDebugInfo();
10761 ABORT();
10762 }
10763 ASSERT((*itr)->GetTypeId() == TYPEID_UNIT);
10764
10765 if (!(*itr)->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN))
10766 continue;
10767
10768 if (AddGuidValue(UNIT_FIELD_SUMMON, (*itr)->GetGUID()))
10769 {
10770 // show another pet bar if there is no charm bar
10771 if (IsPlayer() && !GetCharmGUID())
10772 {
10773 if ((*itr)->IsPet())
10775 else
10777 }
10778 }
10779 break;
10780 }
10781 }
10782 }
10783 }
10784}
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:45
@ SPELL_EFFECT_SUMMON
Definition: SharedDefines.h:806
@ SUMMON_TYPE_MINIPET
Definition: SharedDefines.h:3299
const SummonPropertiesEntry *const m_Properties
Definition: TemporarySummon.h:63
bool IsGuardianPet() const
Definition: TemporarySummon.cpp:390
bool IsPetGhoul() const
Definition: TemporarySummon.h:84
void PetSpellInitialize()
Definition: Player.cpp:9424
uint32 GetSpell(uint8 slot=0) const
Definition: Totem.h:59
void OutDebugInfo() const
Definition: Unit.cpp:20151
ObjectGuid GetCritterGUID() const
Definition: Unit.h:1169
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:10513
void SetCritterGUID(ObjectGuid guid)
Definition: Unit.h:1168
void setPowerType(Powers power)
Definition: Unit.cpp:9921
void RemoveAllMinionsByEntry(uint32 entry)
Definition: Unit.cpp:10798
uint32 Type
Definition: DBCStructure.h:1913

References ABORT, Object::AddGuidValue(), Player::AddSpellAndCategoryCooldowns(), ASSERT, Player::CharmSpellInitialize(), ObjectGuid::Empty, Object::GetByteValue(), GetCharmGUID(), GetCritterGUID(), Object::GetEntry(), GetGuardianPet(), Object::GetGUID(), GetOwnerGUID(), GetPetGUID(), Totem::GetSpell(), Object::GetUInt32Value(), HasUnitTypeMask(), SpellInfo::IsCooldownStartedOnEvent(), Minion::IsGuardianPet(), IsPet(), Minion::IsPetGhoul(), Object::IsPlayer(), IsTotem(), LOG_DEBUG, LOG_FATAL, m_Controlled, m_ControlledByPlayer, TempSummon::m_Properties, MAX_SPELL_EFFECTS, OutDebugInfo(), PET_SAVE_NOT_IN_SLOT, Player::PetSpellInitialize(), POWER_ENERGY, RemoveAllMinionsByEntry(), Object::RemoveGuidValue(), Player::SendCooldownEvent(), Player::SendRemoveControlBar(), Object::SetByteValue(), SetCritterGUID(), SetMinionGUID(), SetOwnerGUID(), SetPetGUID(), setPowerType(), SetUnitFlag(), SPELL_EFFECT_SUMMON, sSpellMgr, SUMMON_TYPE_MINIPET, ToPet(), Object::ToPlayer(), ToTotem(), SummonPropertiesEntry::Type, TYPEID_UNIT, UNIT_CREATED_BY_SPELL, UNIT_FIELD_BYTES_2, UNIT_FIELD_SUMMON, UNIT_FLAG_PLAYER_CONTROLLED, and UNIT_MASK_CONTROLABLE_GUARDIAN.

Referenced by Player::CreatePet(), Spell::EffectCreateTamedPet(), Spell::EffectTameCreature(), Pet::LoadPetFromDB(), Player::RemovePet(), and Player::SummonPet().

◆ SetMinionGUID()

void Unit::SetMinionGUID ( ObjectGuid  guid)
inline

◆ SetModelVisible()

◆ SetModifierValue()

◆ SetNativeDisplayId()

◆ SetNpcFlag()

void Unit::SetNpcFlag ( NPCFlags  flags)
inline
992{ SetFlag(UNIT_NPC_FLAGS, flags); }

References Object::SetFlag(), and UNIT_NPC_FLAGS.

Referenced by npc_riggle_bassbait::npc_riggle_bassbaitAI::CheckTournamentState(), npc_ulduar_arachnopod_destroyer::npc_ulduar_arachnopod_destroyerAI::DamageTaken(), npc_magister_aledis::DamageTaken(), npc_thrall_warchief::npc_thrall_warchiefAI::DoAction(), boss_vaelastrasz::boss_vaelAI::Initialize(), boss_majordomo::boss_majordomoAI::InitializeAI(), npc_sergeant_bly::npc_sergeant_blyAI::InitializeAI(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::InitializeAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::JustDied(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::JustReachedHome(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_fairbanks::npc_fairbanksAI::MoveInLineOfSight(), npc_chesspiece::MovementInform(), npc_fos_leader_second::npc_fos_leader_secondAI::MovementInform(), npc_pos_leader_second::npc_pos_leader_secondAI::MovementInform(), npc_weegli_blastfuse::npc_weegli_blastfuseAI::MovementInform(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::MovementInform(), npc_chesspiece::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_akama_illidan::npc_akama_illidanAI::PathEndReached(), npc_chicken_cluck::npc_chicken_cluckAI::ReceiveEmote(), npc_plucky::npc_pluckyAI::ReceiveEmote(), Vehicle::RemovePassenger(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_apothecary_hummel::boss_apothecary_hummelAI::Reset(), npc_varian_wrynn::npc_varian_wrynnAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_azuregos::boss_azuregosAI::Reset(), npc_hyjal_jaina::hyjalJainaAI::Reset(), npc_hyjal_thrall::hyjalThrallAI::Reset(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::Reset(), npc_belnistrasz::npc_belnistraszAI::Reset(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::Reset(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_akama_illidan::npc_akama_illidanAI::Reset(), npc_akama_shade::Reset(), npc_magister_aledis::Reset(), Vehicle::Reset(), npc_battle_at_valhalas::npc_battle_at_valhalasAI::ResetData(), NPCStaveQuestAI::ResetState(), boss_majordomo::boss_majordomoAI::SpellHit(), npc_aged_dying_ancient_kodo::npc_aged_dying_ancient_kodoAI::SpellHit(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_xerestrasza::npc_xerestraszaAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_isle_of_conquest_turret::npc_isle_of_conquest_turretAI::UpdateAI(), npc_oculus_drakegiver::npc_oculus_drakegiverAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_shandy_dalaran::npc_shandy_dalaranAI::UpdateAI(), npc_lake_frog::npc_lake_frogAI::UpdateAI(), npc_aeranas::npc_aeranasAI::UpdateAI(), npc_arthas::npc_arthasAI::WaypointReached(), npc_daphne_stilwell::npc_daphne_stilwellAI::WaypointReached(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), npc_general_andorov::WaypointReached(), and npc_cork_gizelton::npc_cork_gizeltonAI::WaypointReached().

◆ SetOwnerGUID()

void Unit::SetOwnerGUID ( ObjectGuid  owner)
10514{
10515 if (GetOwnerGUID() == owner)
10516 return;
10517
10519 if (!owner)
10520 return;
10521
10522 m_applyResilience = !IsVehicle() && owner.IsPlayer();
10523
10524 // Update owner dependent fields
10525 Player* player = ObjectAccessor::GetPlayer(*this, owner);
10526 if (!player || !player->HaveAtClient(this)) // if player cannot see this unit yet, he will receive needed data with create object
10527 return;
10528
10530
10531 UpdateData udata;
10532 WorldPacket packet;
10533 BuildValuesUpdateBlockForPlayer(&udata, player);
10534 udata.BuildPacket(packet);
10535 player->SendDirectMessage(&packet);
10536
10538}
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target)
Definition: Object.cpp:257
void RemoveFieldNotifyFlag(uint16 flag)
Definition: Object.h:192
void SetFieldNotifyFlag(uint16 flag)
Definition: Object.h:191
Definition: UpdateData.h:52
bool BuildPacket(WorldPacket &packet)
Definition: UpdateData.cpp:48
bool HaveAtClient(WorldObject const *u) const
Definition: Player.cpp:11364

References UpdateData::BuildPacket(), Object::BuildValuesUpdateBlockForPlayer(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Player::HaveAtClient(), ObjectGuid::IsPlayer(), IsVehicle(), m_applyResilience, Object::RemoveFieldNotifyFlag(), Player::SendDirectMessage(), Object::SetFieldNotifyFlag(), Object::SetGuidValue(), UF_FLAG_OWNER, and UNIT_FIELD_SUMMONEDBY.

Referenced by GameObject::CastSpell(), Spell::EffectSummonType(), boss_illidari_council_memberAI::EnterEvadeMode(), spell_item_draenic_pale_ale::HandleSummon(), npc_pet_gen_fetch_ball::IsSummonedBy(), boss_razorgore::boss_razorgoreAI::JustSummoned(), Player::LoadFromDB(), SetMinion(), and npc_grimstone::npc_grimstoneAI::UpdateEscortAI().

◆ SetPetGUID()

◆ SetPhaseMask()

void Unit::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
overridevirtual

Reimplemented from WorldObject.

18967{
18968 if (newPhaseMask == GetPhaseMask())
18969 return;
18970
18971 if (IsInWorld())
18972 {
18973 // xinef: to comment, bellow line should be removed
18974 // pussywizard: goign to other phase (valithria, algalon) should not remove such auras
18975 //RemoveNotOwnSingleTargetAuras(newPhaseMask, true); // we can lost access to caster or target
18976
18977 if (!sScriptMgr->CanSetPhaseMask(this, newPhaseMask, update))
18978 return;
18979
18980 // modify hostile references for new phasemask, some special cases deal with hostile references themselves
18981 if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
18982 {
18983 HostileRefMgr& refMgr = getHostileRefMgr();
18984 HostileReference* ref = refMgr.getFirst();
18985
18986 while (ref)
18987 {
18988 if (Unit* unit = ref->GetSource()->GetOwner())
18989 if (Creature* creature = unit->ToCreature())
18990 refMgr.setOnlineOfflineState(creature, creature->InSamePhase(newPhaseMask));
18991
18992 ref = ref->next();
18993 }
18994
18995 // modify threat lists for new phasemask
18996 if (GetTypeId() != TYPEID_PLAYER)
18997 {
19000
19001 // merge expects sorted lists
19002 threatList.sort();
19003 offlineThreatList.sort();
19004 threatList.merge(offlineThreatList);
19005
19006 for (ThreatContainer::StorageType::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
19007 if (Unit* unit = (*itr)->getTarget())
19008 unit->getHostileRefMgr().setOnlineOfflineState(ToCreature(), unit->InSamePhase(newPhaseMask));
19009 }
19010 }
19011 }
19012
19013 WorldObject::SetPhaseMask(newPhaseMask, false);
19014
19015 if (!IsInWorld())
19016 {
19017 return;
19018 }
19019
19020 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); )
19021 {
19022 Unit* controlled = *itr;
19023 ++itr;
19024 if (controlled->GetTypeId() == TYPEID_UNIT)
19025 {
19026 controlled->SetPhaseMask(newPhaseMask, true);
19027 }
19028 }
19029
19030 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
19031 {
19032 if (m_SummonSlot[i])
19033 {
19034 if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
19035 {
19036 summon->SetPhaseMask(newPhaseMask, true);
19037 }
19038 }
19039 }
19040
19041 if (update)
19042 {
19044 }
19045}
FROM * GetSource() const
Definition: Reference.h:97
Definition: HostileRefMgr.h:32
void setOnlineOfflineState(bool isOnline)
Definition: HostileRefMgr.cpp:98
HostileReference * getFirst()
Definition: HostileRefMgr.h:60
HostileReference * next()
Definition: ThreatMgr.h:116
ThreatContainer::StorageType const & GetOfflineThreatList() const
Definition: ThreatMgr.h:275
Unit * GetOwner() const
Definition: ThreatMgr.h:237
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2870
uint32 GetPhaseMask() const
Definition: Object.h:444
void SetPhaseMask(uint32 newPhaseMask, bool update) override
Definition: Unit.cpp:18966

References HostileRefMgr::getFirst(), getHostileRefMgr(), WorldObject::GetMap(), ThreatMgr::GetOfflineThreatList(), ThreatMgr::GetOwner(), WorldObject::GetPhaseMask(), Reference< TO, FROM >::GetSource(), ThreatMgr::GetThreatList(), GetThreatMgr(), Object::GetTypeId(), WorldObject::InSamePhase(), Object::IsInWorld(), m_Controlled, m_SummonSlot, MAX_SUMMON_SLOT, HostileReference::next(), HostileRefMgr::setOnlineOfflineState(), WorldObject::SetPhaseMask(), SetPhaseMask(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, and UpdateObjectVisibility().

Referenced by Pet::Create(), Creature::Create(), misc_commandscript::HandleAppearCommand(), modify_commandscript::HandleModifyPhaseCommand(), npc_commandscript::HandleNpcSetPhaseCommand(), spell_wintergrasp_hide_small_elementals_aura::HandlePeriodicDummy(), AuraEffect::HandlePhase(), Battlefield::HideNpc(), boss_volazj::InitializeAI(), boss_zuramat::boss_zuramatAI::JustSummoned(), npc_the_lich_king_controller::npc_the_lich_king_controllerAI::JustSummoned(), BattlegroundAB::RemovePlayer(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_twilight_halion::boss_twilight_halionAI::Reset(), Creature::setDeathState(), Player::SetGameMaster(), SetPhaseMask(), Battlefield::ShowNpc(), WorldObject::SummonTrigger(), and npc_mootoo_the_younger::npc_mootoo_the_youngerAI::WaypointReached().

◆ SetPower()

void Unit::SetPower ( Powers  power,
uint32  val,
bool  withPowerUpdate = true,
bool  fromRegenerate = false 
)
15494{
15495 if (!fromRegenerate && GetPower(power) == val)
15496 {
15497 return;
15498 }
15499
15500 uint32 maxPower = GetMaxPower(power);
15501 if (maxPower < val)
15502 {
15503 val = maxPower;
15504 }
15505
15506 if (fromRegenerate)
15507 {
15508 UpdateUInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, val);
15510 }
15511 else
15512 {
15513 SetStatInt32Value(static_cast<uint16>(UNIT_FIELD_POWER1) + power, val);
15514 }
15515
15516 if (withPowerUpdate)
15517 {
15519 data << GetPackGUID();
15520 data << uint8(power);
15521 data << uint32(val);
15522 SendMessageToSet(&data, IsPlayer());
15523 }
15524
15525 // group update
15526 if (IsPlayer())
15527 {
15528 Player* player = ToPlayer();
15529 if (getPowerType() == power && player->NeedSendSpectatorData())
15530 {
15531 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", power == POWER_RAGE || power == POWER_RUNIC_POWER ? val / 10 : val);
15532 }
15533
15534 if (player->GetGroup())
15535 {
15537 }
15538 }
15539 else if (Pet* pet = ToCreature()->ToPet())
15540 {
15541 if (pet->isControlled())
15542 {
15543 Unit* owner = GetOwner();
15544 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
15545 {
15547 }
15548 }
15549
15550 // Update the pet's character sheet with happiness damage bonus
15551 if (pet->getPetType() == HUNTER_PET && power == POWER_HAPPINESS)
15552 {
15553 pet->UpdateDamagePhysical(BASE_ATTACK);
15554 }
15555 }
15556}
@ GROUP_UPDATE_FLAG_PET_CUR_POWER
Definition: Group.h:116
@ GROUP_UPDATE_FLAG_CUR_POWER
Definition: Group.h:104
@ SMSG_POWER_UPDATE
Definition: Opcodes.h:1182
void UpdateUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:663
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:524

References Object::AddToObjectUpdateIfNeeded(), BASE_ATTACK, WorldObject::FindMap(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), Object::GetPackGUID(), GetPower(), getPowerType(), GROUP_UPDATE_FLAG_CUR_POWER, GROUP_UPDATE_FLAG_PET_CUR_POWER, HUNTER_PET, Object::IsPlayer(), Player::NeedSendSpectatorData(), POWER_HAPPINESS, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), WorldObject::SendMessageToSet(), Player::SetGroupUpdateFlag(), Object::SetStatInt32Value(), SMSG_POWER_UPDATE, Object::ToCreature(), ToPet(), Object::ToPlayer(), UNIT_FIELD_POWER1, and Object::UpdateUInt32Value().

Referenced by Player::ActivateSpec(), Player::Create(), Pet::CreateBaseAtTamed(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::DoAction(), Spell::EffectSelfResurrect(), Spell::EffectSummonPet(), Player::GiveLevel(), AuraEffect::HandleAuraModShapeshift(), spell_warr_execute::HandleEffect(), modify_commandscript::HandleModifyEnergyCommand(), modify_commandscript::HandleModifyManaCommand(), modify_commandscript::HandleModifyRageCommand(), modify_commandscript::HandleModifyRunicPowerCommand(), spell_dk_pet_scaling::HandlePeriodic(), spell_hun_generic_scaling::HandlePeriodic(), spell_mage_pet_scaling::HandlePeriodic(), spell_sha_feral_spirit_scaling::HandlePeriodic(), spell_warl_generic_scaling::HandlePeriodic(), AuraEffect::HandlePeriodicDummyAuraTick(), WorldSession::HandlePetAbandon(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), Creature::LoadCreatureFromDB(), Player::LoadFromDB(), Pet::LoadPetFromDB(), ModifyPower(), boss_shade_of_aran::OnPowerUpdate(), Player::ProcessDelayedOperations(), Player::Regenerate(), spell_igb_incinerating_blast::RemoveEnergy(), spell_igb_below_zero::RemovePassengers(), boss_curator::Reset(), boss_shade_of_aran::Reset(), boss_selin_fireheart::Reset(), boss_moam::Reset(), npc_obsidian_destroyer::Reset(), npc_obsidian_eradicator::Reset(), npc_obsidian_nullifier::Reset(), boss_deathbringer_saurfang::boss_deathbringer_saurfangAI::Reset(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::Reset(), Player::ResetAllPowers(), Player::RestoreManaAfterDuel(), Player::ResurectUsingRequestData(), Player::ResurrectPlayer(), Creature::SelectLevel(), setDeathState(), SetMaxPower(), setPowerType(), Player::SummonPet(), and npc_dalaran_mage::npc_dalaran_mageAI::UpdateAI().

◆ setPowerType()

void Unit::setPowerType ( Powers  power)
9922{
9923 SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype);
9924
9925 if (IsPlayer())
9926 {
9927 if (ToPlayer()->GetGroup())
9929 }
9930 else if (Pet* pet = ToCreature()->ToPet())
9931 {
9932 if (pet->isControlled())
9933 {
9934 Unit* owner = GetOwner();
9935 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
9937 }
9938 }
9939
9940 float powerMultiplier = 1.0f;
9941 if (!IsPet())
9942 if (Creature* creature = ToCreature())
9943 powerMultiplier = creature->GetCreatureTemplate()->ModMana;
9944
9945 switch (new_powertype)
9946 {
9947 default:
9948 case POWER_MANA:
9949 break;
9950 case POWER_RAGE:
9951 SetMaxPower(POWER_RAGE, uint32(std::ceil(GetCreatePowers(POWER_RAGE) * powerMultiplier)));
9952 SetPower(POWER_RAGE, 0);
9953 break;
9954 case POWER_FOCUS:
9955 SetMaxPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
9956 SetPower(POWER_FOCUS, uint32(std::ceil(GetCreatePowers(POWER_FOCUS) * powerMultiplier)));
9957 break;
9958 case POWER_ENERGY:
9959 SetMaxPower(POWER_ENERGY, uint32(std::ceil(GetCreatePowers(POWER_ENERGY) * powerMultiplier)));
9960 break;
9961 case POWER_HAPPINESS:
9962 SetMaxPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
9963 SetPower(POWER_HAPPINESS, uint32(std::ceil(GetCreatePowers(POWER_HAPPINESS) * powerMultiplier)));
9964 break;
9965 }
9966
9967 if (Player const* player = ToPlayer())
9968 if (player->NeedSendSpectatorData())
9969 {
9970 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "PWT", new_powertype);
9971 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "MPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetMaxPower(new_powertype) / 10 : GetMaxPower(new_powertype));
9972 ArenaSpectator::SendCommand_UInt32Value(FindMap(), GetGUID(), "CPW", new_powertype == POWER_RAGE || new_powertype == POWER_RUNIC_POWER ? GetPower(new_powertype) / 10 : GetPower(new_powertype));
9973 }
9974}
@ GROUP_UPDATE_FLAG_POWER_TYPE
Definition: Group.h:103
@ GROUP_UPDATE_FLAG_PET_POWER_TYPE
Definition: Group.h:115
void SetMaxPower(Powers power, uint32 val)
Definition: Unit.cpp:15558

References WorldObject::FindMap(), GetCreatePowers(), Player::GetGroup(), Object::GetGUID(), GetMaxPower(), GetOwner(), GetPower(), GROUP_UPDATE_FLAG_PET_POWER_TYPE, GROUP_UPDATE_FLAG_POWER_TYPE, IsPet(), Object::IsPlayer(), POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_MANA, POWER_RAGE, POWER_RUNIC_POWER, ArenaSpectator::SendCommand_UInt32Value(), Object::SetByteValue(), Player::SetGroupUpdateFlag(), SetMaxPower(), SetPower(), Object::ToCreature(), ToPet(), Object::ToPlayer(), and UNIT_FIELD_BYTES_0.

Referenced by Pet::CreateBaseAtTamed(), AuraEffect::HandleAuraModShapeshift(), spell_putricide_mutated_transformation::HandleSummon(), Player::InitDataForForm(), Vehicle::Install(), Pet::LoadPetFromDB(), npc_toc_rogue::npc_toc_rogueAI::npc_toc_rogueAI(), SetMinion(), and Player::SummonPet().

◆ SetPvP()

◆ setRace()

void Unit::setRace ( uint8  race)
20923{
20924 if (IsPlayer())
20925 m_race = race;
20926}

References Object::IsPlayer(), and m_race.

◆ SetRedirectThreat()

void Unit::SetRedirectThreat ( ObjectGuid  guid,
uint32  pct 
)
inline
1687{ _redirectThreatInfo.Set(guid, pct); }
void Set(ObjectGuid guid, uint32 pct)
Definition: ThreatMgr.h:302

References _redirectThreatInfo, and RedirectThreatInfo::Set().

Referenced by Spell::EffectRedirectThreat(), and ResetRedirectThreat().

◆ SetResistance()

◆ SetResistanceBuffMods()

void Unit::SetResistanceBuffMods ( SpellSchools  school,
bool  positive,
float  val 
)
inline

◆ SetRooted()

void Unit::SetRooted ( bool  apply,
bool  isStun = false 
)
protected
18122{
18123 if (apply)
18124 {
18125 if (m_rootTimes > 0) // blizzard internal check?
18126 m_rootTimes++;
18127
18128 // MOVEMENTFLAG_ROOT cannot be used in conjunction with MOVEMENTFLAG_MASK_MOVING (tested 3.3.5a)
18129 // this will freeze clients. That's why we remove MOVEMENTFLAG_MASK_MOVING before
18130 // setting MOVEMENTFLAG_ROOT
18132
18133 if (IsFalling())
18134 {
18136 }
18137 else
18138 {
18140 }
18141
18142 // Creature specific
18143 if (GetTypeId() != TYPEID_PLAYER)
18144 {
18145 if (isStun && movespline->Finalized())
18146 {
18148 }
18149 else
18150 {
18151 StopMoving();
18152 }
18153 }
18154
18155 if (m_movedByPlayer)
18156 {
18157 WorldPacket data(SMSG_FORCE_MOVE_ROOT, GetPackGUID().size() + 4);
18158 data << GetPackGUID();
18159 data << m_rootTimes;
18161 }
18162 else
18163 {
18165 data << GetPackGUID();
18166 SendMessageToSet(&data, true);
18167 }
18168 }
18169 else
18170 {
18172
18173 if (!HasUnitState(UNIT_STATE_STUNNED)) // prevent moving if it also has stun effect
18174 {
18175 if (m_movedByPlayer)
18176 {
18178 data << GetPackGUID();
18179 data << m_rootTimes;
18181 }
18182 else
18183 {
18185 data << GetPackGUID();
18186 SendMessageToSet(&data, true);
18187 }
18188 }
18189 }
18190}
@ MOVEMENTFLAG_PENDING_ROOT
Definition: UnitDefines.h:364
@ SMSG_FORCE_MOVE_UNROOT
Definition: Opcodes.h:264
@ SMSG_FORCE_MOVE_ROOT
Definition: Opcodes.h:262
@ SMSG_SPLINE_MOVE_ROOT
Definition: Opcodes.h:824
void StopMovingOnCurrentPos()
Definition: Unit.cpp:16617

References AddUnitMovementFlag(), Movement::MoveSpline::Finalized(), Object::GetPackGUID(), Object::GetTypeId(), HasUnitState(), IsFalling(), m_movedByPlayer, m_rootTimes, MOVEMENTFLAG_MASK_MOVING, MOVEMENTFLAG_PENDING_ROOT, MOVEMENTFLAG_ROOT, movespline, RemoveUnitMovementFlag(), Player::SendDirectMessage(), WorldObject::SendMessageToSet(), SMSG_FORCE_MOVE_ROOT, SMSG_FORCE_MOVE_UNROOT, SMSG_SPLINE_MOVE_ROOT, SMSG_SPLINE_MOVE_UNROOT, StopMoving(), StopMovingOnCurrentPos(), Object::ToPlayer(), TYPEID_PLAYER, and UNIT_STATE_STUNNED.

Referenced by WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), SetControlled(), and SetStunned().

◆ SetShapeshiftForm()

void Unit::SetShapeshiftForm ( ShapeshiftForm  form)
inline

◆ SetSheath()

◆ SetSpeed()

void Unit::SetSpeed ( UnitMoveType  mtype,
float  rate,
bool  forced = false 
)
14356{
14357 if (rate < 0)
14358 rate = 0.0f;
14359
14360 // Update speed only on change
14361 if (m_speed_rate[mtype] == rate)
14362 return;
14363
14364 m_speed_rate[mtype] = rate;
14365
14367
14368 WorldPacket data;
14369 if (!forced)
14370 {
14371 switch (mtype)
14372 {
14373 case MOVE_WALK:
14374 data.Initialize(MSG_MOVE_SET_WALK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14375 break;
14376 case MOVE_RUN:
14377 data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14378 break;
14379 case MOVE_RUN_BACK:
14380 data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14381 break;
14382 case MOVE_SWIM:
14383 data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14384 break;
14385 case MOVE_SWIM_BACK:
14386 data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14387 break;
14388 case MOVE_TURN_RATE:
14389 data.Initialize(MSG_MOVE_SET_TURN_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14390 break;
14391 case MOVE_FLIGHT:
14392 data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14393 break;
14394 case MOVE_FLIGHT_BACK:
14395 data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14396 break;
14397 case MOVE_PITCH_RATE:
14398 data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4);
14399 break;
14400 default:
14401 LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype);
14402 return;
14403 }
14404
14405 data << GetPackGUID();
14406 BuildMovementPacket(&data);
14407 data << float(GetSpeed(mtype));
14408 SendMessageToSet(&data, true);
14409 }
14410 else
14411 {
14412 if (IsPlayer())
14413 {
14414 // register forced speed changes for WorldSession::HandleForceSpeedChangeAck
14415 // and do it only for real sent packets and use run for run/mounted as client expected
14416 ++ToPlayer()->m_forced_speed_changes[mtype];
14417
14418 // Xinef: update speed of pet also
14419 if (!IsInCombat())
14420 {
14421 Unit* pet = ToPlayer()->GetPet();
14422 if (!pet)
14423 pet = GetCharm();
14424
14425 // xinef: do not affect vehicles and possesed pets
14426 if (pet && (pet->HasUnitFlag(UNIT_FLAG_POSSESSED) || pet->IsVehicle()))
14427 pet = nullptr;
14428
14430 pet->UpdateSpeed(mtype, forced);
14431 if (Unit* critter = ObjectAccessor::GetUnit(*this, GetCritterGUID()))
14432 critter->UpdateSpeed(mtype, forced);
14433 }
14434 ToPlayer()->SetCanTeleport(true);
14435 }
14436
14437 switch (mtype)
14438 {
14439 case MOVE_WALK:
14441 break;
14442 case MOVE_RUN:
14444 break;
14445 case MOVE_RUN_BACK:
14447 break;
14448 case MOVE_SWIM:
14450 break;
14451 case MOVE_SWIM_BACK:
14453 break;
14454 case MOVE_TURN_RATE:
14456 break;
14457 case MOVE_FLIGHT:
14459 break;
14460 case MOVE_FLIGHT_BACK:
14462 break;
14463 case MOVE_PITCH_RATE:
14465 break;
14466 default:
14467 LOG_ERROR("entities.unit", "Unit::SetSpeed: Unsupported move type ({}), data not sent to client.", mtype);
14468 return;
14469 }
14470 data << GetPackGUID();
14471 data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39
14472 if (mtype == MOVE_RUN)
14473 data << uint8(0); // new 2.1.0
14474 data << float(GetSpeed(mtype));
14475 SendMessageToSet(&data, true);
14476 }
14477}
@ MOVE_TURN_RATE
Definition: UnitDefines.h:333
@ MOVE_FLIGHT_BACK
Definition: UnitDefines.h:335
@ MOVE_SWIM_BACK
Definition: UnitDefines.h:332
@ MOVE_PITCH_RATE
Definition: UnitDefines.h:336
@ MOVE_RUN_BACK
Definition: UnitDefines.h:330
@ MOVE_WALK
Definition: UnitDefines.h:328
@ FOLLOW_MOTION_TYPE
Definition: MotionMaster.h:52
@ SMSG_FORCE_TURN_RATE_CHANGE
Definition: Opcodes.h:764
@ MSG_MOVE_SET_SWIM_BACK_SPEED
Definition: Opcodes.h:243
@ MSG_MOVE_SET_TURN_RATE
Definition: Opcodes.h:246
@ SMSG_FORCE_WALK_SPEED_CHANGE
Definition: Opcodes.h:760
@ SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE
Definition: Opcodes.h:929
@ MSG_MOVE_SET_PITCH_RATE
Definition: Opcodes.h:1145
@ SMSG_FORCE_RUN_SPEED_CHANGE
Definition: Opcodes.h:256
@ SMSG_FORCE_SWIM_BACK_SPEED_CHANGE
Definition: Opcodes.h:762
@ SMSG_FORCE_RUN_BACK_SPEED_CHANGE
Definition: Opcodes.h:258
@ SMSG_FORCE_FLIGHT_SPEED_CHANGE
Definition: Opcodes.h:927
@ SMSG_FORCE_SWIM_SPEED_CHANGE
Definition: Opcodes.h:260
@ MSG_MOVE_SET_RUN_SPEED
Definition: Opcodes.h:235
@ MSG_MOVE_SET_FLIGHT_SPEED
Definition: Opcodes.h:924
@ MSG_MOVE_SET_WALK_SPEED
Definition: Opcodes.h:239
@ MSG_MOVE_SET_SWIM_SPEED
Definition: Opcodes.h:241
@ MSG_MOVE_SET_FLIGHT_BACK_SPEED
Definition: Opcodes.h:926
@ SMSG_FORCE_PITCH_RATE_CHANGE
Definition: Opcodes.h:1146
@ MSG_MOVE_SET_RUN_BACK_SPEED
Definition: Opcodes.h:237
uint8 m_forced_speed_changes[MAX_MOVE_TYPE]
Definition: Player.h:2376
float GetSpeed(UnitMoveType mtype) const
Definition: Unit.cpp:14350
void propagateSpeedChange()
-------—End of Pet responses methods-------—
Definition: Unit.h:1652
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition: MotionMaster.cpp:910

References BuildMovementPacket(), FOLLOW_MOTION_TYPE, GetCharm(), GetCritterGUID(), MotionMaster::GetCurrentMovementGeneratorType(), GetMotionMaster(), Object::GetPackGUID(), Player::GetPet(), GetSpeed(), Object::GetTypeId(), ObjectAccessor::GetUnit(), HasUnitFlag(), WorldPacket::Initialize(), IsInCombat(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, Player::m_forced_speed_changes, m_speed_rate, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_PITCH_RATE, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_TURN_RATE, MOVE_WALK, MSG_MOVE_SET_FLIGHT_BACK_SPEED, MSG_MOVE_SET_FLIGHT_SPEED, MSG_MOVE_SET_PITCH_RATE, MSG_MOVE_SET_RUN_BACK_SPEED, MSG_MOVE_SET_RUN_SPEED, MSG_MOVE_SET_SWIM_BACK_SPEED, MSG_MOVE_SET_SWIM_SPEED, MSG_MOVE_SET_TURN_RATE, MSG_MOVE_SET_WALK_SPEED, propagateSpeedChange(), WorldObject::SendMessageToSet(), Player::SetCanTeleport(), SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, SMSG_FORCE_FLIGHT_SPEED_CHANGE, SMSG_FORCE_PITCH_RATE_CHANGE, SMSG_FORCE_RUN_BACK_SPEED_CHANGE, SMSG_FORCE_RUN_SPEED_CHANGE, SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, SMSG_FORCE_SWIM_SPEED_CHANGE, SMSG_FORCE_TURN_RATE_CHANGE, SMSG_FORCE_WALK_SPEED_CHANGE, Object::ToPlayer(), TYPEID_UNIT, UNIT_FLAG_POSSESSED, and UpdateSpeed().

Referenced by Battleground::AddCreature(), boss_bug_trio::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), npc_spark_of_ionar::npc_spark_of_ionarAI::DoAction(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::DoAction(), boss_zuljin::boss_zuljinAI::EnterPhase(), npc_pet_dk_ebon_gargoyle::npc_pet_dk_ebon_gargoyleAI::FlyAway(), boss_volkhan::boss_volkhanAI::GoToAnvil(), misc_commandscript::HandleDismountCommand(), spell_mount_check_aura::HandleEffectPeriodic(), boss_sartharion_tenebron::boss_sartharion_tenebronAI::HandleExtraEvent(), boss_sartharion_shadron::boss_sartharion_shadronAI::HandleExtraEvent(), boss_sartharion_vesperon::boss_sartharion_vesperonAI::HandleExtraEvent(), WorldSession::HandleForceSpeedChangeAck(), modify_commandscript::HandleModifyASpeedCommand(), modify_commandscript::HandleModifyMountCommand(), Creature::InitEntry(), boss_glob_of_viscidus::InitializeAI(), Guardian::InitStatsForLevel(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy(), boss_sartharion_dragonAI::JustEngagedWith(), boss_four_horsemen::boss_four_horsemenAI::JustEngagedWith(), boss_ichoron::boss_ichoronAI::JustSummoned(), boss_sartharion::boss_sartharionAI::JustSummoned(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::MountSelf(), boss_onyxia::MovementInform(), boss_bug_trio::MovementInform(), boss_volkhan::boss_volkhanAI::MovementInform(), boss_sindragosa::boss_sindragosaAI::MovementInform(), npc_akilzon_eagle::npc_akilzon_eagleAI::MovementInform(), npc_hor_leader_second::npc_hor_leader_secondAI::MoveToNextStopPoint(), npc_ancestral_wolf::npc_ancestral_wolfAI::npc_ancestral_wolfAI(), npc_batrider::npc_batrider(), npc_hallows_end_soh::npc_hallows_end_soh(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_vehicle_d16_propelled_delivery::npc_vehicle_d16_propelled_deliveryAI::PassengerBoarded(), npc_hover_disk::npc_hover_diskAI::PassengerBoarded(), boss_nightbane::PathEndReached(), npc_eastvale_peasent::PathEndReached(), SmartScript::ProcessAction(), boss_nightbane::Reset(), boss_kalec::boss_kalecAI::Reset(), boss_headless_horseman::Reset(), boss_onyxia::Reset(), boss_bug_trio::Reset(), boss_sartharion_dragonAI::Reset(), boss_sindragosa::boss_sindragosaAI::Reset(), npc_oculus_unstable_sphere::npc_oculus_unstable_sphereAI::Reset(), boss_volkhan::boss_volkhanAI::Reset(), boss_thorim_sif_blizzard::boss_thorim_sif_blizzardAI::Reset(), npc_wild_wyrm::npc_wild_wyrmAI::Reset(), npc_freed_protodrake::npc_freed_protodrakeAI::Reset(), npc_dream_fog::npc_dream_fogAI::ScheduleEvents(), npc_eastvale_peasent::SetData(), Battlefield::SpawnCreature(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UnMountSelf(), npc_akilzon_eagle::npc_akilzon_eagleAI::UpdateAI(), boss_zuljin::boss_zuljinAI::UpdateAI(), boss_onyxia::UpdateAI(), npc_rizzle_sprysprocket::npc_rizzle_sprysprocketAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), boss_yoggsaron_death_orb::boss_yoggsaron_death_orbAI::UpdateAI(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI(), npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI(), npc_ulduar_mimiron_rocket::npc_ulduar_mimiron_rocketAI::UpdateAI(), UpdateSpeed(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetSpeedRate()

◆ SetStandFlags()

◆ SetStandState()

void Unit::SetStandState ( uint8  state)
16655{
16657
16658 if (IsStandState())
16660
16661 if (IsPlayer())
16662 {
16664 data << (uint8)state;
16665 ToPlayer()->GetSession()->SendPacket(&data);
16666 }
16667}
@ UNIT_BYTES_1_OFFSET_STAND_STATE
Definition: UnitDefines.h:23
@ SMSG_STANDSTATE_UPDATE
Definition: Opcodes.h:699

References AURA_INTERRUPT_FLAG_NOT_SEATED, Player::GetSession(), Object::IsPlayer(), IsStandState(), RemoveAurasWithInterruptFlags(), WorldSession::SendPacket(), Object::SetByteValue(), SMSG_STANDSTATE_UPDATE, Object::ToPlayer(), UNIT_BYTES_1_OFFSET_STAND_STATE, and UNIT_FIELD_BYTES_1.

Referenced by _ApplyAura(), npc_mograine::npc_mograineAI::AshbringerEvent(), boss_felmyst::boss_felmystAI::boss_felmystAI(), boss_kologarn::boss_kologarnAI::boss_kologarnAI(), boss_twinemperorsAI::boss_twinemperorsAI(), boss_thekal::CheckPhaseTransition(), npc_ringo::npc_ringoAI::ClearFaint(), npc_kerlonian::npc_kerlonianAI::ClearSleeping(), CombatStart(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), boss_thekal::DamageTaken(), boss_shade_of_aran::DamageTaken(), boss_nightbane::DoAction(), boss_twinemperorsAI::DoAction(), npc_twilight_volunteer::DoAction(), boss_the_lurker_below::DoAction(), boss_leotheras_the_blind::DoAction(), npc_madrigosa::npc_madrigosaAI::DoAction(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::DoAction(), npc_taretha::npc_tarethaAI::DoAction(), Spell::DoAllEffectOnTarget(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::DoNice(), boss_ahune::Emerge(), UtherBatteredHiltEvent::Execute(), SuckBackEvent::Execute(), boss_ahune::ExecuteEvent(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::FeignDeath(), WorldSession::HandleAlterAppearance(), WorldSession::HandleLogoutCancelOpcode(), WorldSession::HandleLogoutRequestOpcode(), WorldSession::HandleMovementOpcodes(), WorldSession::HandlePlayerLoginFromDB(), AuraEffect::HandleSpiritOfRedemption(), WorldSession::HandleStandStateChangeOpcode(), spell_q11322_q11317_the_cleansing::if(), DistractMovementGenerator::Initialize(), npc_ranshalla::npc_ranshallaAI::JustDidDialogueStep(), boss_kalecgos::boss_kalecgosAI::JustEngagedWith(), boss_palehoof::boss_palehoofAI::JustReachedHome(), npc_massive_jormungar::npc_massive_jormungarAI::JustReachedHome(), npc_ferocious_rhino::npc_ferocious_rhinoAI::JustReachedHome(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::JustReachedHome(), npc_frenzied_worgen::npc_frenzied_worgenAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_yoggsaron_brain::boss_yoggsaron_brainAI::JustSummoned(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::JustSummoned(), npc_mograine::npc_mograineAI::MoveInLineOfSight(), boss_anubarak_trial::boss_anubarak_trialAI::MoveInLineOfSight(), boss_kologarn::boss_kologarnAI::MoveInLineOfSight(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::MoveInLineOfSight(), npc_twilight_volunteer::MovementInform(), boss_mr_smite::boss_mr_smiteAI::MovementInform(), npc_madrigosa::npc_madrigosaAI::npc_madrigosaAI(), spell_love_is_in_the_air_romantic_picnic::OnApply(), boss_shade_of_aran::OnPowerUpdate(), npc_kernobee::OnQuestAccept(), npc_koltira_deathweaver::OnQuestAccept(), npc_kerlonian::OnQuestAccept(), npc_gilthares::OnQuestAccept(), npc_ringo::OnQuestAccept(), npc_maghar_captive::OnQuestAccept(), npc_mootoo_the_younger::OnQuestAccept(), npc_bonker_togglevolt::OnQuestAccept(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), Spell::prepare(), PretendToDie(), boss_alar::PretendToDie(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_vaelastrasz::boss_vaelAI::Reset(), boss_mr_smite::boss_mr_smiteAI::Reset(), boss_kalecgos::boss_kalecgosAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), npc_thrall_bfu::npc_thrall_bfuAI::Reset(), boss_thekal::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Reset(), npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_professor_putricide::boss_professor_putricideAI::Reset(), boss_the_lich_king::boss_the_lich_kingAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::Reset(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), npc_unkor_the_ruthless::npc_unkor_the_ruthlessAI::Reset(), Resurrect(), boss_the_lurker_below::SchedulerPhaseOne(), boss_the_lurker_below::SchedulerPhaseTwo(), npc_ringo::npc_ringoAI::SetFaint(), npc_kurenai_captive::npc_kurenai_captiveAI::SetGUID(), SetInCombatState(), npc_kerlonian::npc_kerlonianAI::SetSleeping(), SetStunned(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), npc_draenei_survivor::npc_draenei_survivorAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_wild_wyrm::npc_wild_wyrmAI::SpellHit(), boss_ahune::Submerge(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_eachother(), npc_commander_dawnforge::npc_commander_dawnforgeAI::Turn_to_Pathaleons_Image(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_a_special_surprise::npc_a_special_surpriseAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_corporal_keeshan::npc_corporal_keeshanAI::UpdateAI(), npc_varian_wrynn::npc_varian_wrynnAI::UpdateAI(), npc_thrall_bfu::npc_thrall_bfuAI::UpdateAI(), npc_forest_frog::npc_forest_frogAI::UpdateAI(), npc_alexstraza_the_lifebinder::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), boss_professor_putricide::boss_professor_putricideAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_tallhorn_stag::npc_tallhorn_stagAI::UpdateAI(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::UpdateEscortAI(), GameObject::Use(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::WaypointReached(), and npc_ancestral_wolf::npc_ancestral_wolfAI::WaypointReached().

◆ SetStat()

void Unit::SetStat ( Stats  stat,
int32  val 
)
inline

◆ SetStunned()

void Unit::SetStunned ( bool  apply)
protected
18074{
18076 {
18077 return;
18078 }
18079
18080 if (apply)
18081 {
18082 SetTarget();
18084
18085 if (IsPlayer())
18086 {
18088 }
18089
18090 SetRooted(true, true);
18091
18092 CastStop();
18093 }
18094 else
18095 {
18096 if (IsAlive() && GetVictim())
18098
18099 if (GetTypeId() == TYPEID_UNIT)
18100 {
18101 // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface)
18102 Unit* owner = GetOwner();
18103 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted())
18105
18106 // Xinef: same for charmed npcs
18107 owner = GetCharmer();
18108 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !owner->ToPlayer()->IsMounted())
18110 }
18111 else
18113
18114 if (!HasUnitState(UNIT_STATE_ROOT)) // prevent moving if it also has root effect
18115 {
18116 SetRooted(false, true);
18117 }
18118 }
18119}

References CastStop(), GetCharmer(), Object::GetGUID(), GetOwner(), Object::GetTypeId(), GetVictim(), HasUnitState(), IsAlive(), IsMounted(), Object::IsPlayer(), RemoveUnitFlag(), SetRooted(), SetStandState(), SetTarget(), SetUnitFlag(), Object::ToPlayer(), TYPEID_PLAYER, TYPEID_UNIT, UNIT_FLAG_STUNNED, UNIT_STAND_STATE_STAND, UNIT_STATE_IN_FLIGHT, and UNIT_STATE_ROOT.

Referenced by SetControlled().

◆ SetSwim()

bool Unit::SetSwim ( bool  enable)
virtual

◆ SetTarget()

virtual void Unit::SetTarget ( ObjectGuid  = ObjectGuid::Empty)
pure virtual

◆ setTransForm()

void Unit::setTransForm ( uint32  spellid)
inline
1516{ m_transform = spellid;}

References m_transform.

Referenced by AuraEffect::HandleAuraTransform().

◆ SetUInt32Value()

void Unit::SetUInt32Value ( uint16  index,
uint32  value 
)
21204{
21205 Object::SetUInt32Value(index, value);
21206
21207 switch (index)
21208 {
21209 // Invalidating the cache on health change should fix an issue where the client sees dead NPCs when they are not.
21210 // We might also need to invalidate the cache for some other fields as well.
21211 case UNIT_FIELD_HEALTH:
21213 break;
21214 }
21215}
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
void InvalidateValuesUpdateCache()
Definition: Unit.h:1906

References InvalidateValuesUpdateCache(), Object::SetUInt32Value(), and UNIT_FIELD_HEALTH.

Referenced by Player::_LoadDailyQuestStatus(), Player::_LoadSkills(), Player::AddItemToBuyBackSlot(), Attack(), Player::CheckAreaExploreAndOutdoor(), Spell::CheckItems(), Player::Create(), Pet::CreateBaseAtTamed(), Player::CreatePet(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), Dismount(), boss_thekal::DoAction(), boss_razuvious_minion::boss_razuvious_minionAI::DoAction(), boss_pathaleon_the_calculator::DoAction(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::DoAction(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::DoAction(), Player::DuelComplete(), Spell::EffectSummonPet(), Spell::EffectTameCreature(), boss_jindo::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), npc_unworthy_initiate::npc_unworthy_initiateAI::EventStart(), Player::GiveLevel(), Pet::GivePetLevel(), Pet::GivePetXP(), Player::GiveXP(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::HandleAnimation(), AuraEffect::HandleAuraDummy(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraTransform(), character_commandscript::HandleCharacterLevel(), debug_commandscript::HandleDebugMod32ValueCommand(), debug_commandscript::HandleDebugUpdateCommand(), spell_dk_dancing_rune_weapon_visual::HandleEffectApply(), spell_gen_model_visible::HandleEffectApply(), spell_gen_model_visible::HandleEffectRemove(), spell_gen_baby_murloc::HandleEffectRemove(), boss_ragnaros::boss_ragnarosAI::HandleEmerge(), misc_commandscript::HandleHideAreaCommand(), modify_commandscript::HandleModifyStandStateCommand(), modify_commandscript::HandleMorphMountCommand(), WorldSession::HandleMovementOpcodes(), AuraEffect::HandleNoReagentUseAura(), npc_commandscript::HandleNpcPlayEmoteCommand(), WorldSession::HandlePetRename(), reset_commandscript::HandleResetHonorCommand(), reset_commandscript::HandleResetLevelCommand(), reset_commandscript::HandleResetStatsOrLevelHelper(), WorldSession::HandleSelfResOpcode(), WorldSession::HandleSetTitleOpcode(), WorldSession::HandleSetWatchedFactionOpcode(), misc_commandscript::HandleShowAreaCommand(), WorldSession::HandleTextEmoteOpcode(), titles_commandscript::HandleTitlesCurrentCommand(), titles_commandscript::HandleTitlesRemoveCommand(), titles_commandscript::HandleTitlesSetMaskCommand(), Player::InitGlyphsForLevel(), npc_rabid_thistle_bear::npc_rabid_thistle_bearAI::Initialize(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::InitializeAI(), Player::InitStatsForLevel(), Guardian::InitStatsForLevel(), InitTamedPet(), npc_toc5_grand_champion_minion::npc_toc5_grand_champion_minionAI::JustDied(), boss_xt002::boss_xt002AI::JustEngagedWith(), npc_dragonflayer_forge_master::npc_dragonflayer_forge_masterAI::JustEngagedWith(), boss_jindo::JustEngagedWith(), npc_tirion_fordring_tft::npc_tirion_fordringAI::JustReachedHome(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustSummoned(), npc_tirions_gambit_tirion::npc_tirions_gambit_tirionAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), Kill(), Creature::LoadCreaturesAddon(), Creature::LoadEquipment(), Player::LoadFromDB(), Pet::LoadPetFromDB(), WorldSession::LogoutPlayer(), Player::ModifySkillBonus(), Mount(), npc_icc_nerubar_broodkeeper::npc_icc_nerubar_broodkeeperAI::MoveInLineOfSight(), boss_grand_champion::boss_grand_championAI::MovementInform(), boss_professor_putricide::boss_professor_putricideAI::MovementInform(), npc_tirion_fordring_tft::npc_tirion_fordringAI::MovementInform(), npc_thassarian2::npc_thassarian2AI::MovementInform(), npc_apothecary_genericAI::MovementInform(), npc_pos_martin_or_gorkun_second::npc_pos_martin_or_gorkun_secondAI::npc_pos_martin_or_gorkun_secondAI(), spell_gen_clone_weapon_aura::OnApply(), instance_trial_of_the_champion::instance_trial_of_the_champion_InstanceMapScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), npc_ame::OnQuestAccept(), go_crystalline_tear::OnQuestAccept(), spell_gen_clone_weapon_aura::OnRemove(), npc_eastvale_peasent::PathEndReached(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), Player::RemoveAmmo(), Player::RemoveItemFromBuyBackSlot(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::ReorderInstance(), ReplaceAllDynamicFlags(), ReplaceAllNpcFlags(), Player::ReplaceAllPlayerFlags(), ReplaceAllUnitFlags(), ReplaceAllUnitFlags2(), boss_ragnaros::boss_ragnarosAI::Reset(), npc_unworthy_initiate::npc_unworthy_initiateAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_zuljin::boss_zuljinAI::Reset(), boss_arlokk::boss_arlokkAI::Reset(), boss_grand_champion::boss_grand_championAI::Reset(), npc_hor_leader::npc_hor_leaderAI::Reset(), boss_malygos::boss_malygosAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), npc_hidden_cultist::npc_hidden_cultistAI::Reset(), npc_thassarian2::npc_thassarian2AI::Reset(), npc_amberpine_woodsman::npc_amberpine_woodsmanAI::Reset(), npc_crusade_recruit::npc_crusade_recruitAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), Player::ResetDailyQuestStatus(), boss_razuvious_minion::boss_razuvious_minionAI::ScheduleAttackDummy(), Spell::SendChannelStart(), Spell::SendChannelUpdate(), Player::SetAmmo(), Player::SetArenaPoints(), Player::SetArenaTeamInfoField(), SetCharmedBy(), SetCreateHealth(), SetCreateMana(), Player::SetCurrentTitle(), Player::SetDailyQuestStatus(), npc_ulduar_vx001::npc_ulduar_vx001AI::SetData(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::SetData(), npc_eastvale_peasent::SetData(), setDeathState(), Player::setDeathState(), SetDisplayId(), ScriptedAI::SetEquipmentSlots(), SetFaction(), Player::SetFreePrimaryProfessions(), Player::SetFreeTalentPoints(), Player::SetGlyph(), Player::SetGlyphSlot(), SetHealth(), Player::SetHonorPoints(), Player::SetInGuild(), SetLevel(), SetMaxHealth(), Player::SetMoney(), SetNativeDisplayId(), CharmInfo::SetPetNumber(), Player::SetQuestSlot(), Player::SetQuestSlotTimer(), Player::SetRank(), Player::SetRestBonus(), Player::SetSkill(), Player::SetVisibleItemSlot(), npc_injured_patient::npc_injured_patientAI::SpellHit(), npc_icc_valkyr_herald::npc_icc_valkyr_heraldAI::SpellHitTarget(), Map::SummonCreature(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SummonedCreatureDespawn(), Player::SummonPet(), Player::SwapQuestSlot(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::UpdateAI(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), npc_partygoer_pather::UpdateAI(), npc_partygoer::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_harrison_jones::npc_harrison_jonesAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::UpdateAI(), npc_clintar_spirit::npc_clintar_spiritAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_hor_leader_second::npc_hor_leader_secondAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), npc_tirion_fordring_tft::npc_tirion_fordringAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), npc_ulduar_expedition_engineer::npc_ulduar_expedition_engineerAI::UpdateAI(), npc_thassarian2::npc_thassarian2AI::UpdateAI(), npc_amberpine_woodsman::npc_amberpine_woodsmanAI::UpdateAI(), npc_crusade_recruit::npc_crusade_recruitAI::UpdateAI(), npc_dragonmaw_peon::npc_dragonmaw_peonAI::UpdateAI(), Player::UpdateArmorPenetration(), Player::UpdateDuelFlag(), Player::UpdateExpertise(), Player::UpdateHonorFields(), Player::UpdateRating(), Player::UpdateShieldBlockValue(), Player::UpdateSkill(), Player::UpdateSkillPro(), Player::UpdateSkillsForLevel(), Player::UpdateSkillsToMaxSkillsForLevel(), npc_black_knight_skeletal_gryphon::npc_black_knight_skeletal_gryphonAI::WaypointReached(), and npc_ranger_lilatha::WaypointReached().

◆ SetUnitFlag()

void Unit::SetUnitFlag ( UnitFlags  flags)
inline

UnitFlags available in UnitDefines.h.

826{ SetFlag(UNIT_FIELD_FLAGS, flags); }

References Object::SetFlag(), and UNIT_FIELD_FLAGS.

Referenced by Vehicle::AddPassenger(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::AddPortals(), Creature::AllLootRemovedFromCorpse(), npc_doctor::npc_doctorAI::BeginEvent(), boss_jarien::boss_jarien(), boss_sothos::boss_sothos(), GameObject::CastSpell(), Player::Create(), boss_felblood_kaelthas::DamageTaken(), npc_mograine::npc_mograineAI::DamageTaken(), boss_apothecary_hummel::boss_apothecary_hummelAI::DamageTaken(), boss_kiljaeden::boss_kiljaedenAI::DamageTaken(), boss_muru::boss_muruAI::DamageTaken(), boss_jedoga_shadowseeker::DamageTaken(), boss_eadric::boss_eadricAI::DamageTaken(), boss_paletress::boss_paletressAI::DamageTaken(), boss_black_knight::boss_black_knightAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_frost_sphere::npc_frost_sphereAI::DamageTaken(), boss_bronjahm::boss_bronjahmAI::DamageTaken(), npc_terenas_menethil::npc_terenas_menethilAI::DamageTaken(), npc_crystalline_frayer::npc_crystalline_frayerAI::DamageTaken(), boss_algalon_the_observer::boss_algalon_the_observerAI::DamageTaken(), boss_freya::boss_freyaAI::DamageTaken(), boss_hodir::boss_hodirAI::DamageTaken(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::DamageTaken(), npc_ulduar_vx001::npc_ulduar_vx001AI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::DamageTaken(), boss_illidan_stormrage::boss_illidan_stormrageAI::DamageTaken(), boss_essence_of_suffering::boss_essence_of_sufferingAI::DamageTaken(), boss_essence_of_desire::boss_essence_of_desireAI::DamageTaken(), boss_taerar::boss_taerarAI::DamageTaken(), npc_molten_golem::npc_molten_golemAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), boss_mal_ganis::boss_mal_ganisAI::DamageTaken(), boss_thorim::boss_thorimAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Deactivate(), DisableRotate(), boss_thorim::boss_thorimAI::DisableThorim(), boss_kirtonos_the_herald::boss_kirtonos_the_heraldAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_crok_scourgebane::npc_crok_scourgebaneAI::DoAction(), boss_algalon_the_observer::boss_algalon_the_observerAI::DoAction(), npc_frozen_core::DoAction(), boss_felmyst::boss_felmystAI::DoAction(), boss_grand_champion::boss_grand_championAI::DoAction(), boss_kelthuzad_minion::boss_kelthuzad_minionAI::DoAction(), npc_xt002_heart::npc_xt002_heartAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), PetAI::DoAttack(), FlightPathMovementGenerator::DoReset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::EnableSara(), boss_cyanigosa::boss_cyanigosaAI::EnterEvadeMode(), boss_erekem::boss_erekemAI::EnterEvadeMode(), boss_ichoron::boss_ichoronAI::EnterEvadeMode(), boss_lavanthor::boss_lavanthorAI::EnterEvadeMode(), boss_moragg::boss_moraggAI::EnterEvadeMode(), boss_xevozz::boss_xevozzAI::EnterEvadeMode(), boss_zuramat::boss_zuramatAI::EnterEvadeMode(), boss_anubarak_trial::boss_anubarak_trialAI::EnterEvadeMode(), boss_jaraxxus::boss_jaraxxusAI::EnterEvadeMode(), boss_gormok::boss_gormokAI::EnterEvadeMode(), boss_jormungarAI::EnterEvadeMode(), boss_icehowl::boss_icehowlAI::EnterEvadeMode(), boss_zuljin::boss_zuljinAI::EnterPhase(), SACDeactivateEvent::Execute(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::FeignDeath(), spell_boss_magus_telestra_summon_telestra_clones_aura::HandleApply(), AuraEffect::HandleArenaPreparation(), AuraEffect::HandleAuraModFaction(), AuraEffect::HandleAuraModPacify(), AuraEffect::HandleAuraModSilence(), spell_q13007_iron_colossus::HandleDummy(), spell_herald_volzaj_insanity::HandleDummyEffect(), spell_gen_model_visible::HandleEffectApply(), spell_gen_feign_death_all_flags::HandleEffectApply(), spell_gen_feign_death_no_dyn_flag::HandleEffectApply(), spell_gen_feign_death_no_prevent_emotes::HandleEffectApply(), AuraEffect::HandleFeignDeath(), BattlefieldWG::HandleKill(), Battleground::HandleKillPlayer(), WorldSession::HandleLogoutRequestOpcode(), spell_oculus_rider_aura::HandleOnEffectApply(), npc_echo_of_medivh::HandlePieceJustDied(), Battlefield::HideNpc(), npc_malchezaar_axe::Initialize(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::Initialize(), npc_scarlet_ghoul::npc_scarlet_ghoulAI::InitializeAI(), boss_kiljaeden::boss_kiljaedenAI::InitializeAI(), npc_general_andorov::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), Player::InitStatsForLevel(), boss_kologarn::boss_kologarnAI::JustDied(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustEngagedWith(), boss_mimiron::boss_mimironAI::JustEngagedWith(), boss_felmyst::boss_felmystAI::JustEngagedWith(), boss_novos::boss_novosAI::JustEngagedWith(), boss_gothik::boss_gothikAI::JustEngagedWith(), boss_kelthuzad::boss_kelthuzadAI::JustEngagedWith(), npc_eris_hevenfire::npc_eris_hevenfireAI::JustSummoned(), boss_majordomo::boss_majordomoAI::JustSummoned(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_illidan_stormrage::boss_illidan_stormrageAI::JustSummoned(), boss_vaelastrasz::boss_vaelAI::JustSummoned(), npc_thrall_bfu::npc_thrall_bfuAI::JustSummoned(), boss_archimonde::JustSummoned(), boss_broggok::JustSummoned(), npc_varian_wrynn::npc_varian_wrynnAI::JustSummoned(), Mount(), npc_shattered_hand_scout::MoveInLineOfSight(), npc_batrider::npc_batrider(), npc_chess_move_trigger::npc_chess_move_trigger(), npc_hol_monument::npc_hol_monumentAI::npc_hol_monumentAI(), npc_mageguard_dalaran::npc_mageguard_dalaranAI::npc_mageguard_dalaranAI(), npc_pos_freed_slave::npc_pos_freed_slaveAI::npc_pos_freed_slaveAI(), npc_q24545_vegard::npc_q24545_vegardAI::npc_q24545_vegardAI(), npc_xt002_heart::npc_xt002_heartAI::npc_xt002_heartAI(), spell_halion_twilight_phasing_aura::OnApply(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), instance_sunken_temple::instance_sunken_temple_InstanceMapScript::OnCreatureCreate(), instance_dire_maul::instance_dire_maul_InstanceMapScript::OnCreatureCreate(), NPCStaveQuestAI::PrepareForEncounter(), PretendToDie(), boss_alar::PretendToDie(), Creature::RefreshSwimmingFlag(), boss_keristrasza::boss_keristraszaAI::RemovePrison(), npc_grimstone::npc_grimstoneAI::Reset(), boss_pyroguard_emberseer::boss_pyroguard_emberseerAI::Reset(), boss_rend_blackhand::boss_rend_blackhandAI::Reset(), boss_nefarian::Reset(), boss_nightbane::Reset(), npc_death_knight_initiate::npc_death_knight_initiateAI::Reset(), npc_koltira_deathweaver::npc_koltira_deathweaverAI::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), npc_hallows_end_soh::Reset(), npc_ancient_wisp::Reset(), boss_cthun::Reset(), npc_depth_charge::npc_depth_chargeAI::Reset(), npc_draenei_survivor::npc_draenei_survivorAI::Reset(), npc_injured_draenei::npc_injured_draeneiAI::Reset(), npc_death_ravager::npc_death_ravagerAI::Reset(), npc_giant_spotlight::npc_giant_spotlightAI::Reset(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::Reset(), boss_jedoga_shadowseeker::Reset(), boss_black_knight::boss_black_knightAI::Reset(), npc_announcer_toc5::npc_announcer_toc5AI::Reset(), boss_anubarak_trial::boss_anubarak_trialAI::Reset(), boss_novos::boss_novosAI::Reset(), boss_tyrannus::boss_tyrannusAI::Reset(), boss_drakkari_colossus::boss_drakkari_colossusAI::Reset(), boss_thaddius::boss_thaddiusAI::Reset(), boss_malygos::boss_malygosAI::Reset(), boss_eregos::boss_eregosAI::Reset(), boss_urom::boss_uromAI::Reset(), boss_varos::boss_varosAI::Reset(), boss_loken::boss_lokenAI::Reset(), boss_sjonnir::boss_sjonnirAI::Reset(), boss_flame_leviathan::boss_flame_leviathanAI::Reset(), npc_ulduar_iron_construct::npc_ulduar_iron_constructAI::Reset(), npc_ulduar_leviathan_mkii::npc_ulduar_leviathan_mkiiAI::Reset(), boss_palehoof::boss_palehoofAI::Reset(), npc_massive_jormungar::npc_massive_jormungarAI::Reset(), npc_ferocious_rhino::npc_ferocious_rhinoAI::Reset(), npc_ravenous_furbolg::npc_ravenous_furbolgAI::Reset(), npc_frenzied_worgen::npc_frenzied_worgenAI::Reset(), boss_ymiron::boss_ymironAI::Reset(), npc_drakuru_shackles::npc_drakuru_shacklesAI::Reset(), boss_shade_of_akama::Reset(), boss_leotheras_the_blind::Reset(), boss_the_lurker_below::Reset(), boss_warlord_kalithresh::Reset(), boss_broggok::Reset(), boss_kelidan_the_breaker::Reset(), boss_magtheridon::Reset(), npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::Reset(), npc_torloth_the_magnificent::npc_torloth_the_magnificentAI::Reset(), npc_injured_patient::npc_injured_patientAI::Reset(), instance_blood_furnace::instance_blood_furnace_InstanceMapScript::ResetPrisoner(), boss_the_lurker_below::SchedulerPhaseOne(), Player::SendLoot(), SetCharm(), SetCharmedBy(), SetImmuneToNPC(), SetImmuneToPC(), SetInCombatState(), Player::SetIsSpectator(), SetMinion(), SetStunned(), SetSwim(), boss_victor_nefarius::boss_victor_nefariusAI::sGossipSelect(), Battlefield::ShowNpc(), boss_zuljin::boss_zuljinAI::SpawnAdds(), npc_netherspite_infernal::SpellHit(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_wounded_skirmisher::SpellHit(), npc_venture_co_straggler::npc_venture_co_stragglerAI::SpellHit(), npc_nether_drake::npc_nether_drakeAI::SpellHit(), npc_injured_patient::npc_injured_patientAI::SpellHit(), boss_ionar::boss_ionarAI::Split(), boss_noth::boss_nothAI::StartBalconyPhase(), boss_lord_valthalak::boss_lord_valthalakAI::StartTalking(), npc_giant_claw_tentacle::Submerge(), boss_ouro::Submerge(), boss_ahune::Submerge(), boss_jedoga_shadowseeker::SummonedCreatureDies(), boss_vaelastrasz::boss_vaelAI::UpdateAI(), boss_ragnaros::boss_ragnarosAI::UpdateAI(), boss_mr_smite::boss_mr_smiteAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::UpdateAI(), boss_arlokk::boss_arlokkAI::UpdateAI(), npc_twiggy_flathead::npc_twiggy_flatheadAI::UpdateAI(), boss_anub_arak::boss_anub_arakAI::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_anubarak_trial::boss_anubarak_trialAI::UpdateAI(), npc_nerubian_burrower::npc_nerubian_burrowerAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_krick::boss_krickAI::UpdateAI(), boss_drakkari_colossus::boss_drakkari_colossusAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), npc_cult_fanatic::npc_cult_fanaticAI::UpdateAI(), npc_cult_adherent::npc_cult_adherentAI::UpdateAI(), npc_terenas_menethil::npc_terenas_menethilAI::UpdateAI(), npc_blistering_zombie::npc_blistering_zombieAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_algalon_the_observer::boss_algalon_the_observerAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), boss_svala::boss_svalaAI::UpdateAI(), boss_ymiron::boss_ymironAI::UpdateAI(), npc_azure_saboteur::npc_azure_saboteurAI::UpdateAI(), boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI(), npc_nether_drake::npc_nether_drakeAI::UpdateAI(), npc_artorius::npc_artoriusAI::UpdateAI(), npc_simone::npc_simoneAI::UpdateAI(), npc_nelson::npc_nelsonAI::UpdateAI(), npc_franklin::npc_franklinAI::UpdateAI(), npc_injured_patient::npc_injured_patientAI::UpdateAI(), boss_ichoron::boss_ichoronAI::UpdateAI(), and Creature::UpdateEntry().

◆ SetUnitFlag2()

◆ SetUnitMovementFlags()

◆ SetVisible()

void Unit::SetVisible ( bool  x)
14162{
14163 if (!x)
14165 else
14167
14169}
@ SEC_GAMEMASTER
Definition: Common.h:58

References WorldObject::m_serverSideVisibility, SEC_GAMEMASTER, SEC_PLAYER, SERVERSIDE_VISIBILITY_GM, FlaggedValuesArray32< T_VALUES, T_FLAGS, FLAG_TYPE, ARRAY_SIZE >::SetValue(), and UpdateObjectVisibility().

Referenced by _ExitVehicle(), boss_felmyst::boss_felmystAI::boss_felmystAI(), Creature::Create(), spell_rotface_unstable_ooze_explosion_suicide_aura::DespawnSelf(), boss_victor_nefarius::boss_victor_nefariusAI::DoAction(), boss_archimonde::DoAction(), boss_felmyst::boss_felmystAI::DoAction(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::DoAction(), boss_yoggsaron::boss_yoggsaronAI::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), HideNpcEvent::Execute(), UtherBatteredHiltEvent::Execute(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::FinishQuest(), npc_anachronos_the_ancient::npc_anachronos_the_ancientAI::HandleAnimation(), BattlegroundSA::HandleKillUnit(), Battlefield::HideNpc(), boss_kiljaeden::boss_kiljaedenAI::InitializeAI(), boss_sapphiron::boss_sapphironAI::InitializeAI(), npc_xt002_heart::npc_xt002_heartAI::JustDied(), boss_kalecgos::boss_kalecgosAI::JustReachedHome(), npc_rocket_propelled_warhead::npc_rocket_propelled_warheadAI::JustReachedHome(), SmartAI::JustRespawned(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::JustRespawned(), boss_hazzarah::JustSummoned(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::MoveInLineOfSight(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::MovementInform(), boss_vazruden_the_herald::MovementInform(), npc_shattered_hand_scout::MovementInform(), npc_madrigosa::npc_madrigosaAI::npc_madrigosaAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::npc_time_lost_proto_drakeAI(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::OnCreatureCreate(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::OnCreatureCreate(), instance_forge_of_souls::instance_forge_of_souls_InstanceScript::OnCreatureCreate(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_pit_of_saron::instance_pit_of_saron_InstanceScript::OnCreatureCreate(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), npc_scarlet_miner_cart::npc_scarlet_miner_cartAI::PassengerBoarded(), boss_victor_nefarius::boss_victor_nefariusAI::Reset(), boss_midnight::Reset(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::Reset(), boss_darkmaster_gandling::boss_darkmaster_gandlingAI::Reset(), boss_muru::boss_muruAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::Reset(), boss_archimonde::Reset(), boss_eye_of_cthun::Reset(), npc_murkdeep::npc_murkdeepAI::Reset(), npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI::Reset(), boss_halion::boss_halionAI::Reset(), npc_pos_leader::npc_pos_leaderAI::Reset(), npc_blood_queen_lana_thel::npc_blood_queen_lana_thelAI::Reset(), boss_ionar::boss_ionarAI::Reset(), boss_yoggsaron_sara::boss_yoggsaron_saraAI::Reset(), npc_minigob_manabonk::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::Reset(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::Reset(), boss_vazruden_the_herald::Reset(), npc_enslaved_netherwing_drake::Reset(), npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::Reset(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::SetData(), Battlefield::ShowNpc(), boss_ionar::boss_ionarAI::Split(), boss_warchief_kargath_bladefist::SummonedCreatureDies(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_madrigosa::npc_madrigosaAI::UpdateAI(), boss_kalecgos::boss_kalecgosAI::UpdateAI(), boss_kiljaeden::boss_kiljaedenAI::UpdateAI(), boss_muru::boss_muruAI::UpdateAI(), npc_bh_thalorien_dawnseeker::npc_bh_thalorien_dawnseekerAI::UpdateAI(), npc_ravenclaw_apparition::npc_ravenclaw_apparitionAI::UpdateAI(), npc_arthas::npc_arthasAI::UpdateAI(), npc_murkdeep::npc_murkdeepAI::UpdateAI(), boss_halion::boss_halionAI::UpdateAI(), npc_hor_leader::npc_hor_leaderAI::UpdateAI(), npc_pos_leader::npc_pos_leaderAI::UpdateAI(), boss_sapphiron::boss_sapphironAI::UpdateAI(), boss_ionar::boss_ionarAI::UpdateAI(), npc_vh_teleportation_portal::npc_vh_teleportation_portalAI::UpdateAI(), npc_minigob_manabonk::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), npc_overlord_drakuru_betrayal::npc_overlord_drakuru_betrayalAI::UpdateAI(), npc_commander_dawnforge::npc_commander_dawnforgeAI::UpdateAI(), SmartAI::UpdateDespawn(), npc_grimstone::npc_grimstoneAI::UpdateEscortAI(), npc_time_lost_proto_drake::npc_time_lost_proto_drakeAI::UpdateEscortAI(), npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI::WaypointReached(), and npc_taretha::npc_tarethaAI::WaypointReached().

◆ SetVisibleAura()

void Unit::SetVisibleAura ( uint8  slot,
AuraApplication aur 
)
inline

◆ SetWalk()

bool Unit::SetWalk ( bool  enable)
virtual

Reimplemented in Creature.

20454{
20455 if (enable == IsWalking())
20456 return false;
20457
20458 if (enable)
20460 else
20462
20464 return true;
20465}
bool IsWalking() const
Definition: Unit.h:1722

References AddUnitMovementFlag(), IsWalking(), MOVEMENTFLAG_WALKING, propagateSpeedChange(), and RemoveUnitMovementFlag().

Referenced by debug_commandscript::HandleDebugMoveflagsCommand(), SetCharm(), and Creature::SetWalk().

◆ SetWaterWalking()

bool Unit::SetWaterWalking ( bool  enable,
bool  packetOnly = false 
)
virtual

Allow to walk on water. Doesn't inform the client. Need to use SendMovementWaterWalking() if it's for players.

Reimplemented in Player, and Creature.

20533{
20535 return false;
20536
20537 if (enable)
20539 else
20541
20542 return true;
20543}
@ MOVEMENTFLAG_WATERWALKING
Definition: UnitDefines.h:372

References AddUnitMovementFlag(), HasUnitMovementFlag(), MOVEMENTFLAG_WATERWALKING, and RemoveUnitMovementFlag().

Referenced by AuraEffect::HandleAuraWaterWalk(), debug_commandscript::HandleDebugMoveflagsCommand(), Player::SetWaterWalking(), and Creature::SetWaterWalking().

◆ SpellBaseDamageBonusDone()

int32 Unit::SpellBaseDamageBonusDone ( SpellSchoolMask  schoolMask)
11873{
11874 int32 DoneAdvertisedBenefit = 0;
11875
11877 for (AuraEffectList::const_iterator i = mDamageDone.begin(); i != mDamageDone.end(); ++i)
11878 if (((*i)->GetMiscValue() & schoolMask) != 0 &&
11879 (*i)->GetSpellInfo()->EquippedItemClass == -1 &&
11880 // -1 == any item class (not wand then)
11881 (*i)->GetSpellInfo()->EquippedItemInventoryTypeMask == 0)
11882 // 0 == any inventory type (not wand then)
11883 DoneAdvertisedBenefit += (*i)->GetAmount();
11884
11885 if (IsPlayer())
11886 {
11887 // Base value
11888 DoneAdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
11889
11890 // Damage bonus from stats
11892 for (AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin(); i != mDamageDoneOfStatPercent.end(); ++i)
11893 {
11894 if ((*i)->GetMiscValue() & schoolMask)
11895 {
11896 // stat used stored in miscValueB for this aura
11897 Stats usedStat = Stats((*i)->GetMiscValueB());
11898 DoneAdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
11899 }
11900 }
11901 // ... and attack power
11903 for (AuraEffectList::const_iterator i = mDamageDonebyAP.begin(); i != mDamageDonebyAP.end(); ++i)
11904 if ((*i)->GetMiscValue() & schoolMask)
11905 DoneAdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
11906 }
11907 return DoneAdvertisedBenefit;
11908}
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
Definition: SpellAuraDefines.h:300
@ SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:237
@ SPELL_AURA_MOD_DAMAGE_DONE
Definition: SpellAuraDefines.h:76
uint32 GetBaseSpellPowerBonus()
Definition: Player.h:1947

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellPowerBonus(), GetStat(), GetTotalAttackPowerValue(), Object::IsPlayer(), SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by spell_item_wraith_scythe_drain_life::CalculateDamage(), spell_mage_ice_barrier_aura::CalculateSpellAmount(), spell_mage_ice_barrier::CalculateSpellAmount(), Spell::EffectWeaponDmg(), spell_warl_life_tap::HandleDummy(), HandleDummyAuraProc(), spell_pal_seal_of_righteousness::HandleProc(), SpellDamageBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseDamageBonusTaken()

int32 Unit::SpellBaseDamageBonusTaken ( SpellSchoolMask  schoolMask,
bool  isDoT = false 
)
11911{
11912 int32 TakenAdvertisedBenefit = 0;
11913
11915 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
11916 if (((*i)->GetMiscValue() & schoolMask) != 0)
11917 {
11918 // Xinef: if we have DoT damage type and aura has charges, check if it affects DoTs
11919 // Xinef: required for hemorrhage & rupture / garrote
11920 if (isDoT && (*i)->GetBase()->IsUsingCharges() && !((*i)->GetSpellInfo()->ProcFlags & PROC_FLAG_TAKEN_PERIODIC))
11921 continue;
11922
11923 TakenAdvertisedBenefit += (*i)->GetAmount();
11924 }
11925
11926 return TakenAdvertisedBenefit;
11927}

References GetAuraEffectsByType(), PROC_FLAG_TAKEN_PERIODIC, and SPELL_AURA_MOD_DAMAGE_TAKEN.

Referenced by HandleDummyAuraProc(), spell_pal_seal_of_righteousness::HandleProc(), and SpellDamageBonusTaken().

◆ SpellBaseHealingBonusDone()

int32 Unit::SpellBaseHealingBonusDone ( SpellSchoolMask  schoolMask)
12638{
12639 int32 AdvertisedBenefit = 0;
12640
12642 for (AuraEffectList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i)
12643 if (!(*i)->GetMiscValue() || ((*i)->GetMiscValue() & schoolMask) != 0)
12644 AdvertisedBenefit += (*i)->GetAmount();
12645
12646 // Healing bonus of spirit, intellect and strength
12647 if (IsPlayer())
12648 {
12649 // Base value
12650 AdvertisedBenefit += ToPlayer()->GetBaseSpellPowerBonus();
12651
12652 // Healing bonus from stats
12654 for (AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin(); i != mHealingDoneOfStatPercent.end(); ++i)
12655 {
12656 // stat used dependent from misc value (stat index)
12657 Stats usedStat = Stats((*i)->GetSpellInfo()->Effects[(*i)->GetEffIndex()].MiscValue);
12658 AdvertisedBenefit += int32(CalculatePct(GetStat(usedStat), (*i)->GetAmount()));
12659 }
12660
12661 // ... and attack power
12663 for (AuraEffectList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i)
12664 if ((*i)->GetMiscValue() & schoolMask)
12665 AdvertisedBenefit += int32(CalculatePct(GetTotalAttackPowerValue(BASE_ATTACK), (*i)->GetAmount()));
12666 }
12667 return AdvertisedBenefit;
12668}
@ SPELL_AURA_MOD_HEALING_DONE
Definition: SpellAuraDefines.h:198
@ SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
Definition: SpellAuraDefines.h:238
@ SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
Definition: SpellAuraDefines.h:301

References BASE_ATTACK, CalculatePct(), GetAuraEffectsByType(), Player::GetBaseSpellPowerBonus(), GetStat(), GetTotalAttackPowerValue(), Object::IsPlayer(), SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER, SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT, and Object::ToPlayer().

Referenced by CalculateSpellAmount(), SpellHealingBonusDone(), lfg::LFGMgr::UpdateRaidBrowser(), and Player::UpdateSpellDamageAndHealingBonus().

◆ SpellBaseHealingBonusTaken()

int32 Unit::SpellBaseHealingBonusTaken ( SpellSchoolMask  schoolMask)
12671{
12672 int32 AdvertisedBenefit = 0;
12673
12675 for (AuraEffectList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i)
12676 if (((*i)->GetMiscValue() & schoolMask) != 0)
12677 AdvertisedBenefit += (*i)->GetAmount();
12678
12679 return AdvertisedBenefit;
12680}
@ SPELL_AURA_MOD_HEALING
Definition: SpellAuraDefines.h:178

References GetAuraEffectsByType(), and SPELL_AURA_MOD_HEALING.

Referenced by SpellHealingBonusTaken().

◆ SpellCriticalDamageBonus()

uint32 Unit::SpellCriticalDamageBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
12217{
12218 // Calculate critical bonus
12219 int32 crit_bonus = damage;
12220 float crit_mod = 0.0f;
12221
12222 switch (spellProto->DmgClass)
12223 {
12224 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
12227 crit_bonus += damage;
12228 break;
12229 default:
12230 crit_bonus += damage / 2; // for spells is 50%
12231 break;
12232 }
12233
12234 if (caster)
12235 {
12236 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, spellProto->GetSchoolMask());
12237
12238 if (victim)
12239 crit_mod += caster->GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, victim->GetCreatureTypeMask());
12240
12241 if (crit_bonus != 0 && crit_mod != 0.0f)
12242 AddPct(crit_bonus, crit_mod);
12243
12244 crit_bonus -= damage;
12245
12246 // adds additional damage to critBonus (from talents)
12247 if (Player* modOwner = caster->GetSpellModOwner())
12248 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
12249
12250 crit_bonus += damage;
12251 }
12252
12253 return crit_bonus;
12254}

References AddPct(), SpellInfo::DmgClass, GetCreatureTypeMask(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAuraModifierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_DAMAGE_BONUS, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by CalculateSpellDamageTaken(), AuraEffect::HandlePeriodicDamageAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellCriticalHealingBonus()

uint32 Unit::SpellCriticalHealingBonus ( Unit const *  caster,
SpellInfo const *  spellProto,
uint32  damage,
Unit const *  victim 
)
static
Todo:
: write here full calculation for melee/ranged spells
12257{
12258 // Calculate critical bonus
12259 int32 crit_bonus;
12260 switch (spellProto->DmgClass)
12261 {
12262 case SPELL_DAMAGE_CLASS_MELEE: // for melee based spells is 100%
12265 crit_bonus = damage;
12266 break;
12267 default:
12268 crit_bonus = damage / 2; // for spells is 50%
12269 break;
12270 }
12271
12272 if (caster)
12273 {
12274 if (victim)
12275 {
12276 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
12277 crit_bonus = int32(crit_bonus * caster->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, creatureTypeMask));
12278 }
12279
12280 // adds additional damage to critBonus (from talents)
12281 // xinef: used for death knight death coil
12282 if (Player* modOwner = caster->GetSpellModOwner())
12283 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRIT_DAMAGE_BONUS, crit_bonus);
12284 }
12285
12286 if (crit_bonus > 0)
12287 damage += crit_bonus;
12288
12289 if (caster)
12290 damage = int32(float(damage) * caster->GetTotalAuraMultiplier(SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT));
12291
12292 return damage;
12293}
@ SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT
Definition: SpellAuraDefines.h:113

References SpellInfo::DmgClass, GetCreatureTypeMask(), GetSpellModOwner(), GetTotalAuraMultiplier(), GetTotalAuraMultiplierByMiscMask(), SpellInfo::Id, SPELL_AURA_MOD_CRIT_PERCENT_VERSUS, SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_RANGED, and SPELLMOD_CRIT_DAMAGE_BONUS.

Referenced by Spell::DoAllEffectOnTarget(), and AuraEffect::HandlePeriodicHealAurasTick().

◆ SpellDamageBonusDone()

uint32 Unit::SpellDamageBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
11551{
11552 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
11553 return pdamage;
11554
11555 // Some spells don't benefit from done mods
11556 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
11557 return pdamage;
11558
11559 // For totems get damage bonus from owner
11560 if (GetTypeId() == TYPEID_UNIT)
11561 {
11562 if (IsTotem())
11563 {
11564 if (Unit* owner = GetOwner())
11565 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, effIndex, TotalMod, stack);
11566 }
11567 // Dancing Rune Weapon...
11568 else if (GetEntry() == 27893)
11569 {
11570 if (Unit* owner = GetOwner())
11571 return owner->SpellDamageBonusDone(victim, spellProto, pdamage, damagetype, TotalMod, stack) / 2;
11572 }
11573 }
11574
11575 // Done total percent damage auras
11576 float ApCoeffMod = 1.0f;
11577 int32 DoneTotal = 0;
11578 float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
11579
11580 // Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controled Damage
11582 DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
11583
11584 // Some spells don't benefit from pct done mods
11585 if (!spellProto->HasAttribute(SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS))
11586 {
11587 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
11588 // Add flat bonus from spell damage versus
11590 }
11591
11592 // done scripted mod (take it from owner)
11593 Unit* owner = GetOwner() ? GetOwner() : this;
11594 int32 DoneAdvertisedBenefit = 0;
11595 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
11596 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
11597 {
11598 if (!(*i)->IsAffectedOnSpell(spellProto))
11599 continue;
11600
11601 switch ((*i)->GetMiscValue())
11602 {
11603 case 4418: // Increased Shock Damage
11604 case 4554: // Increased Lightning Damage
11605 case 4555: // Improved Moonfire
11606 case 5142: // Increased Lightning Damage
11607 case 5147: // Improved Consecration / Libram of Resurgence
11608 case 5148: // Idol of the Shooting Star
11609 case 6008: // Increased Lightning Damage
11610 case 8627: // Totem of Hex
11611 {
11612 DoneAdvertisedBenefit += (*i)->GetAmount();
11613 break;
11614 }
11615 }
11616 }
11617
11618 // Custom scripted damage
11619 switch (spellProto->SpellFamilyName)
11620 {
11621 case SPELLFAMILY_DRUID:
11622 {
11623 // Insect Swarm vs Item - Druid T8 Balance Relic
11624 if (spellProto->SpellFamilyFlags[0] & 0x00200000)
11625 {
11626 if (AuraEffect const* relicAurEff = GetAuraEffect(64950, EFFECT_0))
11627 {
11628 DoneAdvertisedBenefit += relicAurEff->GetAmount();
11629 }
11630 }
11631
11632 // Nourish vs Idol of the Flourishing Life
11633 if (spellProto->SpellFamilyFlags[1] & 0x02000000)
11634 {
11635 if (AuraEffect const* relicAurEff = GetAuraEffect(64949, EFFECT_0))
11636 {
11637 DoneAdvertisedBenefit += relicAurEff->GetAmount();
11638 }
11639 }
11640 break;
11641 }
11643 {
11644 // Sigil of the Vengeful Heart
11645 if (spellProto->SpellFamilyFlags[0] & 0x2000)
11646 {
11647 if (AuraEffect* aurEff = GetAuraEffect(64962, EFFECT_1))
11648 {
11649 AddPct(DoneTotal, aurEff->GetAmount());
11650 }
11651 }
11652
11653 // Impurity
11655 {
11656 AddPct(ApCoeffMod, aurEff->GetAmount());
11657 }
11658
11659 // Blood Boil - bonus for diseased targets
11660 if ((spellProto->SpellFamilyFlags[0] & 0x00040000) && victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, GetGUID()))
11661 {
11662 DoneTotal += 95;
11663 ApCoeffMod = 1.5835f;
11664 }
11665 break;
11666 }
11667 default:
11668 break;
11669 }
11670
11671 // Done fixed damage bonus auras
11672 DoneAdvertisedBenefit += SpellBaseDamageBonusDone(spellProto->GetSchoolMask());
11673
11674 // Check for table values
11675 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
11676 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
11677 if (bonus)
11678 {
11679 if (damagetype == DOT)
11680 {
11681 coeff = bonus->dot_damage;
11682 if (bonus->ap_dot_bonus > 0)
11683 {
11684 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
11686 APbonus += GetTotalAttackPowerValue(attType);
11687 DoneTotal += int32(bonus->ap_dot_bonus * stack * ApCoeffMod * APbonus);
11688 }
11689 }
11690 else
11691 {
11692 coeff = bonus->direct_damage;
11693 if (bonus->ap_bonus > 0)
11694 {
11695 WeaponAttackType attType = (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK;
11697 APbonus += GetTotalAttackPowerValue(attType);
11698 DoneTotal += int32(bonus->ap_bonus * stack * ApCoeffMod * APbonus);
11699 }
11700 }
11701 }
11702
11703 // Default calculation
11704 if (coeff && DoneAdvertisedBenefit)
11705 {
11706 float factorMod = CalculateLevelPenalty(spellProto) * stack;
11707
11708 if (Player* modOwner = GetSpellModOwner())
11709 {
11710 coeff *= 100.0f;
11711 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
11712 coeff /= 100.0f;
11713 }
11714
11715 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
11716 }
11717
11718 float tmpDamage = (float(pdamage) + DoneTotal) * DoneTotalMod;
11719 // apply spellmod to Done damage (flat and pct)
11720 if (Player* modOwner = GetSpellModOwner())
11721 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, tmpDamage);
11722
11723 return uint32(std::max(tmpDamage, 0.0f));
11724}
@ SPELLMOD_DOT
Definition: SpellDefines.h:99
@ SPELLMOD_BONUS_MULTIPLIER
Definition: SpellDefines.h:101
@ SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS
Definition: SpellAuraDefines.h:243
@ SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS
Definition: SharedDefines.h:633
float GetSpellDamageMod(int32 Rank)
Definition: Creature.cpp:1604
float SpellPctDamageModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:11219
float CalculateLevelPenalty(SpellInfo const *spellProto) const
Definition: Unit.cpp:3007
Definition: SpellMgr.h:324
float ap_dot_bonus
Definition: SpellMgr.h:328
float dot_damage
Definition: SpellMgr.h:326
float ap_bonus
Definition: SpellMgr.h:327
float direct_damage
Definition: SpellMgr.h:325

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, EFFECT_0, EFFECT_1, SpellInfo::Effects, GetAuraEffect(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetOwner(), SpellInfo::GetSchoolMask(), Creature::GetSpellDamageMod(), GetSpellModOwner(), GetTotalAttackPowerValue(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::Id, IsControlledByPlayer(), IsGuardian(), IsPet(), SpellInfo::IsRangedWeaponSpell(), IsTotem(), RANGED_ATTACK, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS, SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS, SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS, SPELL_DAMAGE_CLASS_MELEE, SpellBaseDamageBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctDamageModsDone(), sSpellMgr, Object::ToCreature(), and TYPEID_UNIT.

Referenced by spell_warl_seed_of_corruption_aura::CalculateAmount(), AuraEffect::CalculateAmount(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), spell_warr_bloodthirst::HandleDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandleProcTriggerDamageAuraProc().

◆ SpellDamageBonusTaken()

uint32 Unit::SpellDamageBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  pdamage,
DamageEffectType  damagetype,
uint32  stack = 1 
)
11727{
11728 if (!spellProto || damagetype == DIRECT_DAMAGE)
11729 return pdamage;
11730
11731 int32 TakenTotal = 0;
11732 float TakenTotalMod = 1.0f;
11733
11734 // from positive and negative SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
11735 // multiplicative bonus, for example Dispersion + Shadowform (0.10*0.85=0.085)
11737 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
11738 if (((*i)->GetMiscValue() & spellProto->GetSchoolMask()))
11739 if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11740 AddPct(TakenTotalMod, (*i)->GetAmount());
11741
11742 TakenTotalMod = processDummyAuras(TakenTotalMod);
11743
11744 // From caster spells
11745 if (caster)
11746 {
11748 for (AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
11749 if ((*i)->GetCasterGUID() == caster->GetGUID() && (*i)->IsAffectedOnSpell(spellProto))
11750 if (spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11751 AddPct(TakenTotalMod, (*i)->GetAmount());
11752 }
11753
11754 if (uint32 mechanicMask = spellProto->GetAllEffectsMechanicMask())
11755 {
11756 int32 modifierMax = 0;
11757 int32 modifierMin = 0;
11759 for (AuraEffectList::const_iterator i = auraEffectList.begin(); i != auraEffectList.end(); ++i)
11760 {
11761 if (!spellProto->ValidateAttribute6SpellDamageMods(caster, *i, damagetype == DOT))
11762 continue;
11763
11764 // Only death knight spell with this aura
11765 if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT)
11766 if (!caster || caster->GetGUID() != (*i)->GetCasterGUID())
11767 continue;
11768
11769 if (mechanicMask & uint32(1 << (*i)->GetMiscValue()))
11770 {
11771 if ((*i)->GetAmount() > 0)
11772 {
11773 if ((*i)->GetAmount() > modifierMax)
11774 modifierMax = (*i)->GetAmount();
11775 }
11776 else if ((*i)->GetAmount() < modifierMin)
11777 modifierMin = (*i)->GetAmount();
11778 }
11779 }
11780
11781 AddPct(TakenTotalMod, modifierMax);
11782 AddPct(TakenTotalMod, modifierMin);
11783 }
11784
11785 int32 TakenAdvertisedBenefit = SpellBaseDamageBonusTaken(spellProto->GetSchoolMask(), damagetype == DOT);
11786
11787 // Check for table values
11788 float coeff = 0;
11789 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
11790 if (bonus)
11791 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
11792
11793 // Default calculation
11794 if (TakenAdvertisedBenefit)
11795 {
11796 if (coeff <= 0.0f)
11797 {
11798 if (caster)
11799 coeff = caster->CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
11800 else
11801 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack);
11802 }
11803
11804 float factorMod = CalculateLevelPenalty(spellProto) * stack;
11805 TakenTotal += int32(TakenAdvertisedBenefit * coeff * factorMod);
11806 }
11807
11808 // No positive taken bonus, custom attr
11809 if (spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS) && TakenTotalMod > 1.0f)
11810 {
11811 TakenTotal = 0;
11812 TakenTotalMod = 1.0f;
11813 }
11814
11815 // xinef: sanctified wrath talent
11816 if (caster && TakenTotalMod < 1.0f && caster->HasAuraType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST))
11817 {
11818 float ignoreModifier = 1.0f - TakenTotalMod;
11819 bool addModifier = false;
11821 for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j)
11822 if ((*j)->GetMiscValue() & spellProto->SchoolMask)
11823 {
11824 ApplyPct(ignoreModifier, (*j)->GetAmount());
11825 addModifier = true;
11826 }
11827
11828 if (addModifier)
11829 TakenTotalMod += ignoreModifier;
11830 }
11831
11832 float tmpDamage = (float(pdamage) + TakenTotal) * TakenTotalMod;
11833
11834 return uint32(std::max(tmpDamage, 0.0f));
11835}
float CalculateDefaultCoefficient(SpellInfo const *spellInfo, DamageEffectType damagetype) const
Definition: Unit.cpp:17124

References AddPct(), ApplyPct(), CalculateDefaultCoefficient(), CalculateLevelPenalty(), DIRECT_DAMAGE, SpellBonusEntry::direct_damage, DOT, SpellBonusEntry::dot_damage, SpellInfo::GetAllEffectsMechanicMask(), GetAuraEffectsByType(), Object::GetGUID(), SpellInfo::GetSchoolMask(), SpellInfo::HasAttribute(), HasAuraType(), SpellInfo::Id, processDummyAuras(), SpellInfo::SchoolMask, SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS, SPELL_AURA_MOD_DAMAGE_FROM_CASTER, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_IGNORE_TARGET_RESIST, SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT, SpellBaseDamageBonusTaken(), SPELLFAMILY_DEATHKNIGHT, sSpellMgr, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by DealMeleeDamage(), Spell::EffectHealthLeech(), Spell::EffectPowerDrain(), Spell::EffectSchoolDMG(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), AuraEffect::HandleProcTriggerDamageAuraProc(), and spell_black_temple_l5_arcane_charge::PrepareSpellScript().

◆ SpellDoneCritChance()

float Unit::SpellDoneCritChance ( Unit const *  ,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
11930{
11931 // Mobs can't crit with spells.
11932 if (GetTypeId() == TYPEID_UNIT && !GetSpellModOwner())
11933 return -100.0f;
11934
11935 // not critting spell
11936 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
11937 return 0.0f;
11938
11939 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
11940 if (!skipEffectCheck && !spellProto->IsCritCapable())
11941 return 0.0f;
11942
11943 float crit_chance = 0.0f;
11944 switch (spellProto->DmgClass)
11945 {
11947 {
11948 if (schoolMask & SPELL_SCHOOL_MASK_NORMAL)
11949 crit_chance = 0.0f;
11950 // For other schools
11951 else if (IsPlayer())
11952 crit_chance = GetFloatValue(static_cast<uint16>(PLAYER_SPELL_CRIT_PERCENTAGE1) + GetFirstSchoolInMask(schoolMask));
11953 else
11954 {
11955 crit_chance = (float)m_baseSpellCritChance;
11957 }
11958 break;
11959 }
11962 {
11963 if (IsPlayer())
11964 {
11965 switch (attackType)
11966 {
11967 case BASE_ATTACK:
11969 break;
11970 case OFF_ATTACK:
11972 break;
11973 case RANGED_ATTACK:
11975 break;
11976 default:
11977 break;
11978 }
11979 }
11980 else
11981 {
11982 crit_chance = 5.0f;
11985 }
11987 break;
11988 }
11989 // values overridden in spellmgr for lifebloom and earth shield
11991 default:
11992 return 0.0f;
11993 }
11994
11995 // percent done
11996 // only players use intelligence for critical chance computations
11997 if (Player* modOwner = GetSpellModOwner())
11998 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_CRITICAL_CHANCE, crit_chance);
11999
12000 // xinef: can be negative!
12001 return crit_chance;
12002}
@ SPELLMOD_CRITICAL_CHANCE
Definition: SpellDefines.h:84
@ SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
Definition: SpellAuraDefines.h:134
@ PLAYER_SPELL_CRIT_PERCENTAGE1
Definition: UpdateFields.h:354
@ SPELL_ATTR2_CANT_CRIT
Definition: SharedDefines.h:485

References BASE_ATTACK, SpellInfo::DmgClass, GetFirstSchoolInMask(), Object::GetFloatValue(), GetSpellModOwner(), GetTotalAuraModifier(), GetTotalAuraModifierByMiscMask(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsCritCapable(), Object::IsPlayer(), m_baseSpellCritChance, OFF_ATTACK, PLAYER_CRIT_PERCENTAGE, PLAYER_OFFHAND_CRIT_PERCENTAGE, PLAYER_RANGED_CRIT_PERCENTAGE, PLAYER_SPELL_CRIT_PERCENTAGE1, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_CRIT_PCT, SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, SPELL_AURA_MOD_WEAPON_CRIT_PERCENT, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_SCHOOL_MASK_NORMAL, SPELLMOD_CRITICAL_CHANCE, and TYPEID_UNIT.

Referenced by Spell::DoAllEffectOnLaunchTarget().

◆ SpellHealingBonusDone()

uint32 Unit::SpellHealingBonusDone ( Unit victim,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint8  effIndex,
float  TotalMod = 0.0f,
uint32  stack = 1 
)
12388{
12389 // For totems get healing bonus from owner (statue isn't totem in fact)
12390 if (GetTypeId() == TYPEID_UNIT && IsTotem())
12391 if (Unit* owner = GetOwner())
12392 return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effIndex, TotalMod, stack);
12393
12394 // No bonus healing for potion spells
12395 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
12396 return healamount;
12397
12398 float ApCoeffMod = 1.0f;
12399 float DoneTotalMod = TotalMod ? TotalMod : SpellPctHealingModsDone(victim, spellProto, damagetype);
12400 int32 DoneTotal = 0;
12401
12402 // done scripted mod (take it from owner)
12403 Unit* owner = GetOwner() ? GetOwner() : this;
12404 int32 DoneAdvertisedBenefit = 0;
12405 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12406 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12407 {
12408 if (!(*i)->IsAffectedOnSpell(spellProto))
12409 continue;
12410
12411 switch ((*i)->GetMiscValue())
12412 {
12413 case 4415: // Increased Rejuvenation Healing
12414 case 4953:
12415 DoneAdvertisedBenefit += (*i)->GetAmount();
12416 break;
12417 case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
12418 DoneAdvertisedBenefit += (*i)->GetAmount();
12419 break;
12420 }
12421 }
12422
12423 switch (spellProto->SpellFamilyName)
12424 {
12426 {
12427 // Impurity
12429 {
12430 AddPct(ApCoeffMod, aurEff->GetAmount());
12431 }
12432 break;
12433 }
12434 default:
12435 break;
12436 }
12437
12438 // Done fixed damage bonus auras
12439 DoneAdvertisedBenefit += SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
12440 float coeff = spellProto->Effects[effIndex].BonusMultiplier;
12441
12442 // Check for table values
12443 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
12444 if(bonus)
12445 {
12446 if (damagetype == DOT)
12447 {
12448 coeff = bonus->dot_damage;
12449 if (bonus->ap_dot_bonus > 0)
12450 DoneTotal += int32(bonus->ap_dot_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
12451 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
12452 }
12453 else
12454 {
12455 coeff = bonus->direct_damage;
12456 if (bonus->ap_bonus > 0)
12457 DoneTotal += int32(bonus->ap_bonus * ApCoeffMod * stack * GetTotalAttackPowerValue(
12458 (spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
12459 }
12460 }
12461 else
12462 {
12463 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
12464 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
12465 return healamount;
12466 }
12467
12468 // Default calculation
12469 if (DoneAdvertisedBenefit)
12470 {
12471 float factorMod = CalculateLevelPenalty(spellProto) * stack;
12472 if (Player* modOwner = GetSpellModOwner())
12473 {
12474 coeff *= 100.0f;
12475 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
12476 coeff /= 100.0f;
12477 }
12478 DoneTotal += int32(DoneAdvertisedBenefit * coeff * factorMod);
12479 }
12480
12481 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12482 {
12483 switch (spellProto->Effects[i].ApplyAuraName)
12484 {
12485 // Bonus healing does not apply to these spells
12488 DoneTotal = 0;
12489 break;
12490 }
12491 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
12492 DoneTotal = 0;
12493 }
12494
12495 // use float as more appropriate for negative values and percent applying
12496 float heal = float(int32(healamount) + DoneTotal) * DoneTotalMod;
12497 // apply spellmod to Done amount
12498
12499 if (Player* modOwner = GetSpellModOwner())
12500 modOwner->ApplySpellMod(spellProto->Id, damagetype == DOT ? SPELLMOD_DOT : SPELLMOD_DAMAGE, heal);
12501
12502 return uint32(std::max(heal, 0.0f));
12503}
@ SPELL_AURA_PERIODIC_HEALTH_FUNNEL
Definition: SpellAuraDefines.h:125
int32 SpellBaseHealingBonusDone(SpellSchoolMask schoolMask)
Definition: Unit.cpp:12637
float SpellPctHealingModsDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype)
Definition: Unit.cpp:12295

References AddPct(), SpellBonusEntry::ap_bonus, SpellBonusEntry::ap_dot_bonus, BASE_ATTACK, CalculateLevelPenalty(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, SpellInfo::Effects, GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), SpellInfo::GetSchoolMask(), GetSpellModOwner(), GetTotalAttackPowerValue(), Object::GetTypeId(), SpellInfo::Id, SpellInfo::IsRangedWeaponSpell(), IsTotem(), MAX_SPELL_EFFECTS, RANGED_ATTACK, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEALTH_FUNNEL, SPELL_AURA_PERIODIC_LEECH, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_EFFECT_HEALTH_LEECH, SpellBaseHealingBonusDone(), SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_POTION, SpellInfo::SpellFamilyName, SPELLMOD_BONUS_MULTIPLIER, SPELLMOD_DAMAGE, SPELLMOD_DOT, SpellPctHealingModsDone(), sSpellMgr, and TYPEID_UNIT.

Referenced by AuraEffect::CalculateAmount(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_dru_lifebloom::HandleDispel(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHealingBonusTaken()

uint32 Unit::SpellHealingBonusTaken ( Unit caster,
SpellInfo const *  spellProto,
uint32  healamount,
DamageEffectType  damagetype,
uint32  stack = 1 
)
12506{
12507 float TakenTotalMod = 1.0f;
12508 float minval = 0.0f;
12509
12510 // Healing taken percent
12511 if (!sScriptMgr->OnSpellHealingBonusTakenNegativeModifiers(this, caster, spellProto, minval))
12512 {
12514 }
12515
12516 if (minval)
12517 AddPct(TakenTotalMod, minval);
12518
12520 if (maxval)
12521 AddPct(TakenTotalMod, maxval);
12522
12523 // Tenacity increase healing % taken
12524 if (AuraEffect const* Tenacity = GetAuraEffect(58549, 0))
12525 AddPct(TakenTotalMod, Tenacity->GetAmount());
12526
12527 // Healing Done
12528 int32 TakenTotal = 0;
12529
12530 // Taken fixed damage bonus auras
12531 int32 TakenAdvertisedBenefit = SpellBaseHealingBonusTaken(spellProto->GetSchoolMask());
12532
12533 // Nourish cast, glyph of nourish
12534 if (spellProto->SpellFamilyName == SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags[1] & 0x2000000 && caster)
12535 {
12536 bool any = false;
12537 bool hasglyph = caster->GetAuraEffectDummy(62971);
12539 for (AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
12540 {
12541 if (((*i)->GetCasterGUID() == caster->GetGUID()))
12542 {
12543 SpellInfo const* spell = (*i)->GetSpellInfo();
12544 // Rejuvenation, Regrowth, Lifebloom, or Wild Growth
12545 if (!any && spell->SpellFamilyFlags.HasFlag(0x50, 0x4000010, 0))
12546 {
12547 TakenTotalMod *= 1.2f;
12548 any = true;
12549 }
12550
12551 if (hasglyph)
12552 TakenTotalMod += 0.06f;
12553 }
12554 }
12555 }
12556
12557 if (damagetype == DOT)
12558 {
12559 // Healing over time taken percent
12560 float minval_hot = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HOT_PCT));
12561 if (minval_hot)
12562 AddPct(TakenTotalMod, minval_hot);
12563
12564 float maxval_hot = float(GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HOT_PCT));
12565 if (maxval_hot)
12566 AddPct(TakenTotalMod, maxval_hot);
12567 }
12568
12569 // Check for table values
12570 SpellBonusEntry const* bonus = sSpellMgr->GetSpellBonusData(spellProto->Id);
12571 float coeff = 0;
12572 float factorMod = 1.0f;
12573 if (bonus)
12574 coeff = (damagetype == DOT) ? bonus->dot_damage : bonus->direct_damage;
12575 else
12576 {
12577 // No bonus healing for SPELL_DAMAGE_CLASS_NONE class spells by default
12578 if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
12579 {
12580 healamount = uint32(std::max((float(healamount) * TakenTotalMod), 0.0f));
12581 return healamount;
12582 }
12583 }
12584
12585 // Default calculation
12586 if (TakenAdvertisedBenefit)
12587 {
12588 float TakenCoeff = 0.0f;
12589 if (coeff <= 0)
12590 coeff = CalculateDefaultCoefficient(spellProto, damagetype) * int32(stack) * 1.88f; // As wowwiki says: C = (Cast Time / 3.5) * 1.88 (for healing spells)
12591
12592 factorMod *= CalculateLevelPenalty(spellProto) * int32(stack);
12593 if (Player* modOwner = GetSpellModOwner())
12594 {
12595 coeff *= 100.0f;
12596 modOwner->ApplySpellMod(spellProto->Id, SPELLMOD_BONUS_MULTIPLIER, coeff);
12597 coeff /= 100.0f;
12598 }
12599
12600 TakenTotal += int32(TakenAdvertisedBenefit * (coeff > 0 ? coeff : TakenCoeff) * factorMod);
12601 }
12602
12603 if (caster)
12604 {
12606 for (AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
12607 if (caster->GetGUID() == (*i)->GetCasterGUID() && (*i)->IsAffectedOnSpell(spellProto))
12608 AddPct(TakenTotalMod, (*i)->GetAmount());
12609 }
12610
12611 for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
12612 {
12613 switch (spellProto->Effects[i].ApplyAuraName)
12614 {
12615 // Bonus healing does not apply to these spells
12618 TakenTotal = 0;
12619 break;
12620 }
12621 if (spellProto->Effects[i].Effect == SPELL_EFFECT_HEALTH_LEECH)
12622 TakenTotal = 0;
12623 }
12624
12625 // No positive taken bonus, custom attr
12626 if ((spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS) || spellProto->HasAttribute(SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS)) && TakenTotalMod > 1.0f)
12627 {
12628 TakenTotal = 0;
12629 TakenTotalMod = 1.0f;
12630 }
12631
12632 float heal = float(int32(healamount) + TakenTotal) * TakenTotalMod;
12633
12634 return uint32(std::max(heal, 0.0f));
12635}
@ SPELL_AURA_MOD_HEALING_RECEIVED
Definition: SpellAuraDefines.h:346
@ SPELL_AURA_MOD_HEALING_PCT
Definition: SpellAuraDefines.h:181
@ SPELL_AURA_MOD_HOT_PCT
Definition: SpellAuraDefines.h:322
@ SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS
Definition: SharedDefines.h:631
int32 GetMaxPositiveAuraModifier(AuraType auratype)
Definition: Unit.cpp:5886
int32 GetMaxNegativeAuraModifier(AuraType auratype) const
Definition: Unit.cpp:5900
int32 SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask)
Definition: Unit.cpp:12670

References AddPct(), SpellBonusEntry::direct_damage, SpellInfo::DmgClass, DOT, SpellBonusEntry::dot_damage, GetAuraEffect(), GetAuraEffectDummy(), GetAuraEffectsByType(), Object::GetGUID(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), SpellInfo::GetSchoolMask(), flag96::HasFlag(), SpellInfo::Id, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_HOT_PCT, SPELL_AURA_PERIODIC_HEAL, SPELL_DAMAGE_CLASS_NONE, SpellBaseHealingBonusTaken(), SPELLFAMILY_DRUID, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, sScriptMgr, and sSpellMgr.

Referenced by spell_dru_lifebloom::AfterRemove(), Spell::DoAllEffectOnTarget(), Spell::EffectHeal(), Spell::EffectHealMechanical(), Spell::EffectHealPct(), spell_pri_renew::HandleApplyEffect(), Aura::HandleAuraSpecificMods(), AuraEffect::HandlePeriodicHealAurasTick(), and AuraEffect::HandlePeriodicHealthLeechAuraTick().

◆ SpellHitResult() [1/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
Spell const *  spell,
bool  canReflect = false 
)
Todo:
: client not show miss log for this spells - so need find info for this in dbc and use it!
3503{
3504 SpellInfo const* spellInfo = spell->GetSpellInfo();
3505
3506 // Check for immune
3507 if (victim->IsImmunedToSpell(spellInfo, spell))
3508 {
3509 return SPELL_MISS_IMMUNE;
3510 }
3511
3512 // All positive spells can`t miss
3514 if ((spellInfo->IsPositive() || spellInfo->HasEffect(SPELL_EFFECT_DISPEL))
3515 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3516 {
3517 return SPELL_MISS_NONE;
3518 }
3519
3520 // Check for immune
3521 // xinef: check for school immunity only
3522 if (victim->IsImmunedToSchool(spell))
3523 {
3524 return SPELL_MISS_IMMUNE;
3525 }
3526
3527 if (this == victim)
3528 {
3529 return SPELL_MISS_NONE;
3530 }
3531
3532 // Return evade for units in evade mode
3533 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks() && !spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) &&
3535 {
3536 return SPELL_MISS_EVADE;
3537 }
3538
3539 // Try victim reflect spell
3540 if (CanReflect)
3541 {
3542 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3543 Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
3544 for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
3545 {
3546 if ((*i)->GetMiscValue() & spell->GetSpellSchoolMask())
3547 {
3548 reflectchance += (*i)->GetAmount();
3549 }
3550 }
3551
3552 if (reflectchance > 0 && roll_chance_i(reflectchance))
3553 {
3554 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3555 //ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3556 return SPELL_MISS_REFLECT;
3557 }
3558 }
3559
3560 switch (spellInfo->DmgClass)
3561 {
3564 return MeleeSpellHitResult(victim, spellInfo);
3566 {
3567 if (spellInfo->SpellFamilyName)
3568 {
3569 return SPELL_MISS_NONE;
3570 }
3571
3572 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3573 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3574 {
3575 if (spellInfo->Effects[i].Effect && spellInfo->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3576 {
3577 if (spellInfo->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3578 {
3579 return SPELL_MISS_NONE;
3580 }
3581 }
3582 }
3583 [[fallthrough]];
3584 }
3586 return MagicSpellHitResult(victim, spellInfo);
3587 }
3588
3589 return SPELL_MISS_NONE;
3590}
@ SPELL_AURA_REFLECT_SPELLS
Definition: SpellAuraDefines.h:91
@ SPELL_EFFECT_DISPEL
Definition: SharedDefines.h:816
@ SPELL_MISS_IMMUNE
Definition: SharedDefines.h:1526
@ SPELL_MISS_EVADE
Definition: SharedDefines.h:1525
@ SPELL_MISS_REFLECT
Definition: SharedDefines.h:1530
SpellMissInfo MagicSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition: Unit.cpp:3294
SpellMissInfo MeleeSpellHitResult(Unit *victim, SpellInfo const *spell)
Definition: Unit.cpp:3121
uint32 DmgClass
Definition: SpellInfo.h:389

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, GetAuraEffectsByType(), Spell::GetSpellInfo(), Spell::GetSpellSchoolMask(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, Object::ToCreature(), and TYPEID_UNIT.

◆ SpellHitResult() [2/2]

SpellMissInfo Unit::SpellHitResult ( Unit victim,
SpellInfo const *  spell,
bool  canReflect = false 
)
Todo:
: client not show miss log for this spells - so need find info for this in dbc and use it!
3438{
3439 // Check for immune
3440 if (victim->IsImmunedToSpell(spell))
3441 return SPELL_MISS_IMMUNE;
3442
3443 // All positive spells can`t miss
3445 if ((spell->IsPositive() || spell->HasEffect(SPELL_EFFECT_DISPEL))
3446 && (!IsHostileTo(victim))) // prevent from affecting enemy by "positive" spell
3447 return SPELL_MISS_NONE;
3448
3449 // Check for immune
3450 // xinef: check for school immunity only
3451 if (victim->IsImmunedToSchool(spell))
3452 return SPELL_MISS_IMMUNE;
3453
3454 if (this == victim)
3455 return SPELL_MISS_NONE;
3456
3457 // Return evade for units in evade mode
3458 if (victim->GetTypeId() == TYPEID_UNIT && victim->ToCreature()->IsEvadingAttacks() && !spell->HasAura(SPELL_AURA_CONTROL_VEHICLE)
3459 && !spell->HasAttribute(SPELL_ATTR0_CU_IGNORE_EVADE) && !spell->HasAttribute(SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT))
3460 return SPELL_MISS_EVADE;
3461
3462 // Try victim reflect spell
3463 if (CanReflect)
3464 {
3465 int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
3466 Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
3467 for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
3468 if ((*i)->GetMiscValue() & spell->GetSchoolMask())
3469 reflectchance += (*i)->GetAmount();
3470 if (reflectchance > 0 && roll_chance_i(reflectchance))
3471 {
3472 // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
3473 //ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spell);
3474 return SPELL_MISS_REFLECT;
3475 }
3476 }
3477
3478 switch (spell->DmgClass)
3479 {
3482 return MeleeSpellHitResult(victim, spell);
3484 {
3485 if (spell->SpellFamilyName)
3486 {
3487 return SPELL_MISS_NONE;
3488 }
3489 // Xinef: apply DAMAGE_CLASS_MAGIC conditions to damaging DAMAGE_CLASS_NONE spells
3490 for (uint8 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
3491 if (spell->Effects[i].Effect && spell->Effects[i].Effect != SPELL_EFFECT_SCHOOL_DAMAGE)
3492 if (spell->Effects[i].ApplyAuraName != SPELL_AURA_PERIODIC_DAMAGE)
3493 return SPELL_MISS_NONE;
3494 [[fallthrough]];
3495 }
3497 return MagicSpellHitResult(victim, spell);
3498 }
3499 return SPELL_MISS_NONE;
3500}

References SpellInfo::DmgClass, EFFECT_0, SpellInfo::Effects, GetAuraEffectsByType(), SpellInfo::GetSchoolMask(), GetTotalAuraModifier(), Object::GetTypeId(), SpellInfo::HasAttribute(), SpellInfo::HasAura(), SpellInfo::HasEffect(), Creature::IsEvadingAttacks(), IsHostileTo(), IsImmunedToSchool(), IsImmunedToSpell(), SpellInfo::IsPositive(), MagicSpellHitResult(), MAX_SPELL_EFFECTS, MeleeSpellHitResult(), roll_chance_i(), SPELL_ATTR0_CU_IGNORE_EVADE, SPELL_ATTR1_AURA_STAYS_AFTER_COMBAT, SPELL_AURA_CONTROL_VEHICLE, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_REFLECT_SPELLS, SPELL_AURA_REFLECT_SPELLS_SCHOOL, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELL_EFFECT_DISPEL, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_MISS_EVADE, SPELL_MISS_IMMUNE, SPELL_MISS_NONE, SPELL_MISS_REFLECT, SpellInfo::SpellFamilyName, Object::ToCreature(), and TYPEID_UNIT.

Referenced by Spell::AddUnitTarget(), DealMeleeDamage(), AuraEffect::HandlePeriodicDamageAurasTick(), AuraEffect::HandlePeriodicHealthLeechAuraTick(), and AuraEffect::HandlePeriodicManaLeechAuraTick().

◆ SpellPctDamageModsDone()

float Unit::SpellPctDamageModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
11220{
11221 if (!spellProto || !victim || damagetype == DIRECT_DAMAGE)
11222 return 1.0f;
11223
11224 // Some spells don't benefit from done mods
11225 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
11226 return 1.0f;
11227
11228 // For totems get damage bonus from owner
11229 if (GetTypeId() == TYPEID_UNIT)
11230 {
11231 if (IsTotem())
11232 {
11233 if (Unit* owner = GetOwner())
11234 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
11235 }
11236 // Dancing Rune Weapon...
11237 else if (GetEntry() == 27893)
11238 {
11239 if (Unit* owner = GetOwner())
11240 return owner->SpellPctDamageModsDone(victim, spellProto, damagetype);
11241 }
11242 }
11243
11244 // Done total percent damage auras
11245 float DoneTotalMod = 1.0f;
11246
11248 for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
11249 {
11250 // prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization)
11251 if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1 &&
11252 !(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && (*i)->GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
11253 {
11254 continue;
11255 }
11256
11257 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11258 continue;
11259
11260 if (!sScriptMgr->IsNeedModSpellDamagePercent(this, *i, DoneTotalMod, spellProto))
11261 continue;
11262
11263 if ((*i)->GetMiscValue() & spellProto->GetSchoolMask())
11264 {
11265 if ((*i)->GetSpellInfo()->EquippedItemClass == -1)
11266 AddPct(DoneTotalMod, (*i)->GetAmount());
11267 else if (!(*i)->GetSpellInfo()->HasAttribute(SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM) && ((*i)->GetSpellInfo()->EquippedItemSubClassMask == 0))
11268 AddPct(DoneTotalMod, (*i)->GetAmount());
11269 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo()))
11270 AddPct(DoneTotalMod, (*i)->GetAmount());
11271 }
11272 }
11273
11274 uint32 creatureTypeMask = victim->GetCreatureTypeMask();
11276 for (AuraEffectList::const_iterator i = mDamageDoneVersus.begin(); i != mDamageDoneVersus.end(); ++i)
11277 if ((creatureTypeMask & uint32((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11278 AddPct(DoneTotalMod, (*i)->GetAmount());
11279
11280 // bonus against aurastate
11282 for (AuraEffectList::const_iterator i = mDamageDoneVersusAurastate.begin(); i != mDamageDoneVersusAurastate.end(); ++i)
11283 if (victim->HasAuraState(AuraStateType((*i)->GetMiscValue())) && spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11284 AddPct(DoneTotalMod, (*i)->GetAmount());
11285
11286 // done scripted mod (take it from owner)
11287 Unit* owner = GetOwner() ? GetOwner() : this;
11288 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
11289 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
11290 {
11291 // Xinef: self cast is ommited (because of Rage of Rivendare)
11292 if (!spellProto->ValidateAttribute6SpellDamageMods(this, *i, damagetype == DOT))
11293 continue;
11294
11295 // xinef: Molten Fury should work on all spells
11296 switch ((*i)->GetMiscValue())
11297 {
11298 case 4920: // Molten Fury
11299 case 4919:
11300 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11301 AddPct(DoneTotalMod, (*i)->GetAmount());
11302 break;
11303 }
11304
11305 if (!(*i)->IsAffectedOnSpell(spellProto))
11306 continue;
11307
11308 switch ((*i)->GetMiscValue())
11309 {
11310 case 6917: // Death's Embrace
11311 case 6926:
11312 case 6928:
11313 {
11314 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11315 AddPct(DoneTotalMod, (*i)->GetAmount());
11316 break;
11317 }
11318 // Soul Siphon
11319 case 4992:
11320 case 4993:
11321 {
11322 // effect 1 m_amount
11323 int32 maxPercent = (*i)->GetAmount();
11324 // effect 0 m_amount
11325 int32 stepPercent = CalculateSpellDamage(this, (*i)->GetSpellInfo(), 0);
11326 // count affliction effects and calc additional damage in percentage
11327 int32 modPercent = 0;
11328 AuraApplicationMap const& victimAuras = victim->GetAppliedAuras();
11329 for (AuraApplicationMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
11330 {
11331 Aura const* aura = itr->second->GetBase();
11332 SpellInfo const* m_spell = aura->GetSpellInfo();
11333 if (m_spell->SpellFamilyName != SPELLFAMILY_WARLOCK || !(m_spell->SpellFamilyFlags[1] & 0x0004071B || m_spell->SpellFamilyFlags[0] & 0x8044C402))
11334 continue;
11335 modPercent += stepPercent * aura->GetStackAmount();
11336 if (modPercent >= maxPercent)
11337 {
11338 modPercent = maxPercent;
11339 break;
11340 }
11341 }
11342 AddPct(DoneTotalMod, modPercent);
11343 break;
11344 }
11345 case 6916: // Death's Embrace
11346 case 6925:
11347 case 6927:
11348 if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
11349 AddPct(DoneTotalMod, (*i)->GetAmount());
11350 break;
11351 case 5481: // Starfire Bonus
11352 {
11353 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0, 0))
11354 AddPct(DoneTotalMod, (*i)->GetAmount());
11355 break;
11356 }
11357 // Tundra Stalker
11358 // Merciless Combat
11359 case 7277:
11360 {
11361 // Merciless Combat
11362 if ((*i)->GetSpellInfo()->SpellIconID == 2656)
11363 {
11364 if( (spellProto && spellProto->SpellFamilyFlags[0] & 0x2) || spellProto->SpellFamilyFlags[1] & 0x2 )
11365 if (!victim->HealthAbovePct(35))
11366 AddPct(DoneTotalMod, (*i)->GetAmount());
11367 }
11368 // Tundra Stalker
11369 else
11370 {
11371 // Frost Fever (target debuff)
11372 if (victim->HasAura(55095))
11373 AddPct(DoneTotalMod, (*i)->GetAmount());
11374 break;
11375 }
11376 break;
11377 }
11378 // Rage of Rivendare
11379 case 7293:
11380 {
11382 AddPct(DoneTotalMod, (*i)->GetSpellInfo()->GetRank() * 2.0f);
11383 break;
11384 }
11385 // Twisted Faith
11386 case 7377:
11387 {
11389 AddPct(DoneTotalMod, (*i)->GetAmount());
11390 break;
11391 }
11392 // Marked for Death
11393 case 7598:
11394 case 7599:
11395 case 7600:
11396 case 7601:
11397 case 7602:
11398 {
11399 if (victim->GetAuraEffect(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0, 0))
11400 AddPct(DoneTotalMod, (*i)->GetAmount());
11401 break;
11402 }
11403 // Dirty Deeds
11404 case 6427:
11405 case 6428:
11406 case 6579:
11407 case 6580:
11408 {
11409 if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
11410 {
11411 // effect 0 has expected value but in negative state
11412 int32 bonus = -(*i)->GetBase()->GetEffect(0)->GetAmount();
11413 AddPct(DoneTotalMod, bonus);
11414 }
11415 break;
11416 }
11417 }
11418 }
11419
11420 // Custom scripted damage
11421 switch (spellProto->SpellFamilyName)
11422 {
11423 case SPELLFAMILY_MAGE:
11424 // Ice Lance
11425 if (spellProto->SpellIconID == 186)
11426 {
11427 if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this))
11428 {
11429 // Glyph of Ice Lance
11430 if (owner->HasAura(56377) && victim->GetLevel() > owner->GetLevel())
11431 DoneTotalMod *= 4.0f;
11432 else
11433 DoneTotalMod *= 3.0f;
11434 }
11435 }
11436
11437 // Torment the weak
11438 if (spellProto->SpellFamilyFlags[0] & 0x20600021 || spellProto->SpellFamilyFlags[1] & 0x9000)
11439 if (victim->HasAuraWithMechanic((1 << MECHANIC_SNARE) | (1 << MECHANIC_SLOW_ATTACK)))
11441 AddPct(DoneTotalMod, aurEff->GetAmount());
11442 break;
11443 case SPELLFAMILY_PRIEST:
11444 // Mind Flay
11445 if (spellProto->SpellFamilyFlags[0] & 0x800000)
11446 {
11447 // Glyph of Shadow Word: Pain
11448 if (AuraEffect* aurEff = GetAuraEffect(55687, 0))
11449 // Increase Mind Flay damage if Shadow Word: Pain present on target
11451 AddPct(DoneTotalMod, aurEff->GetAmount());
11452
11453 // Twisted Faith - Mind Flay part
11455 // Increase Mind Flay damage if Shadow Word: Pain present on target
11457 AddPct(DoneTotalMod, aurEff->GetAmount());
11458 }
11459 // Smite
11460 else if (spellProto->SpellFamilyFlags[0] & 0x80)
11461 {
11462 // Glyph of Smite
11463 if (AuraEffect* aurEff = GetAuraEffect(55692, 0))
11464 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, GetGUID()))
11465 AddPct(DoneTotalMod, aurEff->GetAmount());
11466 }
11467 // Shadow Word: Death
11468 else if (spellProto->SpellFamilyFlags[1] & 0x2)
11469 {
11470 // Glyph of Shadow Word: Death
11471 if (AuraEffect* aurEff = GetAuraEffect(55682, 1))
11473 AddPct(DoneTotalMod, aurEff->GetAmount());
11474 }
11475
11476 break;
11478 // Judgement of Vengeance/Judgement of Corruption
11479 if ((spellProto->SpellFamilyFlags[1] & 0x400000) && spellProto->SpellIconID == 2292)
11480 {
11481 // Get stack of Holy Vengeance/Blood Corruption on the target added by caster
11482 uint32 stacks = 0;
11484 for (Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
11485 if (((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID() == GetGUID())
11486 {
11487 stacks = (*itr)->GetBase()->GetStackAmount();
11488 break;
11489 }
11490 // + 10% for each application of Holy Vengeance/Blood Corruption on the target
11491 if (stacks)
11492 AddPct(DoneTotalMod, 10 * stacks);
11493 }
11494 break;
11495 case SPELLFAMILY_DRUID:
11496 // Thorns
11497 if (spellProto->SpellFamilyFlags[0] & 0x100)
11498 {
11499 // Brambles
11500 if (AuraEffect* aurEff = GetAuraEffectOfRankedSpell(16836, 0))
11501 AddPct(DoneTotalMod, aurEff->GetAmount());
11502 }
11503 break;
11505 // Fire and Brimstone
11506 if (spellProto->SpellFamilyFlags[1] & 0x00020040)
11508 {
11510 for (AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
11511 if ((*i)->GetSpellInfo()->SpellIconID == 3173)
11512 {
11513 AddPct(DoneTotalMod, (*i)->GetAmount());
11514 break;
11515 }
11516 }
11517 // Drain Soul - increased damage for targets under 25 % HP
11518 if (spellProto->SpellFamilyFlags[0] & 0x00004000)
11519 if (!victim->HealthAbovePct(25))
11520 DoneTotalMod *= 4;
11521 // Shadow Bite (15% increase from each dot)
11522 if (spellProto->SpellFamilyFlags[1] & 0x00400000 && IsPet())
11523 if (uint8 count = victim->GetDoTsByCaster(GetOwnerGUID()))
11524 AddPct(DoneTotalMod, 15 * count);
11525 break;
11526 case SPELLFAMILY_HUNTER:
11527 // Steady Shot
11528 if (spellProto->SpellFamilyFlags[1] & 0x1)
11529 if (AuraEffect* aurEff = GetAuraEffect(56826, 0)) // Glyph of Steady Shot
11530 if (victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_HUNTER, 0x00004000, 0, 0, GetGUID()))
11531 AddPct(DoneTotalMod, aurEff->GetAmount());
11532 break;
11534 // Improved Icy Touch
11535 if (spellProto->SpellFamilyFlags[0] & 0x2)
11537 AddPct(DoneTotalMod, aurEff->GetAmount());
11538
11539 // Glacier Rot
11540 if (spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x6)
11542 if (victim->GetDiseasesByCaster(owner->GetGUID()) > 0)
11543 AddPct(DoneTotalMod, aurEff->GetAmount());
11544 break;
11545 }
11546
11547 return DoneTotalMod;
11548}
@ MECHANIC_SLOW_ATTACK
Definition: SharedDefines.h:1333
@ AURA_STATE_HEALTHLESS_20_PERCENT
Definition: SharedDefines.h:1293
@ AURA_STATE_CONFLAGRATE
Definition: SharedDefines.h:1306
uint32 GetDiseasesByCaster(ObjectGuid casterGUID, uint8 mode=0)
Definition: Unit.cpp:5772
bool HasAuraWithMechanic(uint32 mechanicMask) const
Definition: Unit.cpp:5743
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:5459
uint32 GetDoTsByCaster(ObjectGuid casterGUID) const
Definition: Unit.cpp:5818

References AddPct(), AURA_STATE_CONFLAGRATE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, CalculateSpellDamage(), DIRECT_DAMAGE, DOT, EFFECT_0, SpellInfo::EquippedItemClass, GetAppliedAuras(), GetAuraEffect(), GetAuraEffectOfRankedSpell(), GetAuraEffectsByType(), GetCreatureTypeMask(), GetDiseasesByCaster(), GetDoTsByCaster(), GetDummyAuraEffect(), Object::GetEntry(), Object::GetGUID(), GetLevel(), GetOwner(), GetOwnerGUID(), SpellInfo::GetSchoolMask(), Aura::GetSpellInfo(), Aura::GetStackAmount(), Object::GetTypeId(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraWithMechanic(), HealthAbovePct(), IsPet(), IsTotem(), MECHANIC_SLOW_ATTACK, MECHANIC_SNARE, SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR5_AURA_AFFECTS_NOT_JUST_REQ_EQUIPPED_ITEM, SPELL_AURA_DUMMY, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_STALKED, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, SPELLFAMILY_DEATHKNIGHT, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_PRIEST, SPELLFAMILY_WARLOCK, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, sScriptMgr, Object::ToPlayer(), TYPEID_UNIT, and SpellInfo::ValidateAttribute6SpellDamageMods().

Referenced by AuraEffect::CalculatePeriodicData(), and SpellDamageBonusDone().

◆ SpellPctHealingModsDone()

float Unit::SpellPctHealingModsDone ( Unit victim,
SpellInfo const *  spellProto,
DamageEffectType  damagetype 
)
12296{
12297 // For totems get healing bonus from owner (statue isn't totem in fact)
12298 if (GetTypeId() == TYPEID_UNIT && IsTotem())
12299 if (Unit* owner = GetOwner())
12300 return owner->SpellPctHealingModsDone(victim, spellProto, damagetype);
12301
12302 // Some spells don't benefit from done mods
12303 if (spellProto->HasAttribute(SPELL_ATTR3_IGNORE_CASTER_MODIFIERS))
12304 return 1.0f;
12305
12306 // xinef: Some spells don't benefit from done mods
12307 if (spellProto->HasAttribute(SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS))
12308 return 1.0f;
12309
12310 // No bonus healing for potion spells
12311 if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
12312 return 1.0f;
12313
12314 float DoneTotalMod = 1.0f;
12315
12316 // Healing done percent
12318 for (auto const& auraEff : mHealingDonePct)
12319 {
12320 if (!sScriptMgr->IsNeedModHealPercent(this, auraEff, DoneTotalMod, spellProto))
12321 continue;
12322
12323 AddPct(DoneTotalMod, auraEff->GetAmount());
12324 }
12325
12326 // done scripted mod (take it from owner)
12327 Unit* owner = GetOwner() ? GetOwner() : this;
12328 AuraEffectList const& mOverrideClassScript = owner->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12329 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12330 {
12331 if (!(*i)->IsAffectedOnSpell(spellProto))
12332 continue;
12333
12334 switch ((*i)->GetMiscValue())
12335 {
12336 case 21: // Test of Faith
12337 case 6935:
12338 case 6918:
12339 if (victim->HealthBelowPct(50))
12340 AddPct(DoneTotalMod, (*i)->GetAmount());
12341 break;
12342 case 7798: // Glyph of Regrowth
12343 {
12345 AddPct(DoneTotalMod, (*i)->GetAmount());
12346 break;
12347 }
12348
12349 case 7871: // Glyph of Lesser Healing Wave
12350 {
12351 // xinef: affected by any earth shield
12352 if (victim->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0, 0x00000400, 0))
12353 AddPct(DoneTotalMod, (*i)->GetAmount());
12354 break;
12355 }
12356 default:
12357 break;
12358 }
12359 }
12360
12361 switch (spellProto->SpellFamilyName)
12362 {
12364 // Talents and glyphs for healing stream totem
12365 if (spellProto->Id == 52042)
12366 {
12367 // Glyph of Healing Stream Totem
12368 if (AuraEffect* dummy = owner->GetAuraEffect(55456, EFFECT_0))
12369 AddPct(DoneTotalMod, dummy->GetAmount());
12370
12371 // Healing Stream totem - Restorative Totems
12372 if (AuraEffect* aurEff = GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 338, 1))
12373 AddPct(DoneTotalMod, aurEff->GetAmount());
12374 }
12375 break;
12376 case SPELLFAMILY_PRIEST:
12377 // T9 HEALING 4P, empowered renew instant heal
12378 if (spellProto->Id == 63544)
12379 if (AuraEffect* aurEff = GetAuraEffect(67202, EFFECT_0))
12380 AddPct(DoneTotalMod, aurEff->GetAmount());
12381 break;
12382 }
12383
12384 return DoneTotalMod;
12385}
@ SPELL_AURA_MOD_HEALING_DONE_PERCENT
Definition: SpellAuraDefines.h:199

References AddPct(), EFFECT_0, GetAuraEffect(), GetAuraEffectsByType(), GetDummyAuraEffect(), GetOwner(), Object::GetTypeId(), SpellInfo::HasAttribute(), HealthBelowPct(), SpellInfo::Id, IsTotem(), SPELL_ATTR3_IGNORE_CASTER_MODIFIERS, SPELL_ATTR6_IGNORE_HEALTH_MODIFIERS, SPELL_AURA_DUMMY, SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, SPELLFAMILY_GENERIC, SPELLFAMILY_POTION, SPELLFAMILY_PRIEST, SPELLFAMILY_SHAMAN, SpellInfo::SpellFamilyName, sScriptMgr, and TYPEID_UNIT.

Referenced by AuraEffect::CalculatePeriodicData(), and SpellHealingBonusDone().

◆ SpellTakenCritChance()

float Unit::SpellTakenCritChance ( Unit const *  caster,
SpellInfo const *  spellProto,
SpellSchoolMask  schoolMask,
float  doneChance,
WeaponAttackType  attackType,
bool  skipEffectCheck 
) const
Todo:
: Not sure whether the fallthrough was a mistake (forgetting a break) or intended. This should be double-checked.
12005{
12006 // not critting spell
12007 if (spellProto->HasAttribute(SPELL_ATTR2_CANT_CRIT))
12008 return 0.0f;
12009
12010 // Xinef: check if spell is capable of critting, auras requires special aura to crit so they can be skipped
12011 if (!skipEffectCheck && !spellProto->IsCritCapable())
12012 return 0.0f;
12013
12014 float crit_chance = doneChance;
12015 switch (spellProto->DmgClass)
12016 {
12018 {
12019 if (!spellProto->IsPositive())
12020 {
12021 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
12022 // xinef: apply max and min only
12024 {
12027 }
12028
12029 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_SPELL);
12030 }
12031 // scripted (increase crit chance ... against ... target by x%
12032 if (caster)
12033 {
12034 AuraEffectList const& mOverrideClassScript = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
12035 for (AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
12036 {
12037 if (!((*i)->IsAffectedOnSpell(spellProto)))
12038 continue;
12039 int32 modChance = 0;
12040 switch ((*i)->GetMiscValue())
12041 {
12042 // Shatter
12043 case 911:
12044 modChance += 16;
12045 [[fallthrough]];
12046 case 910:
12047 modChance += 17;
12048 [[fallthrough]];
12049 case 849:
12050 modChance += 17;
12051 if (!HasAuraState(AURA_STATE_FROZEN, spellProto, caster))
12052 break;
12053 crit_chance += modChance;
12054 break;
12055 case 7917: // Glyph of Shadowburn
12056 if (HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, caster))
12057 crit_chance += (*i)->GetAmount();
12058 break;
12059 case 7997: // Renewed Hope
12060 case 7998:
12061 if (HasAura(6788))
12062 crit_chance += (*i)->GetAmount();
12063 break;
12064 default:
12065 break;
12066 }
12067 }
12068 // Custom crit by class
12069 switch (spellProto->SpellFamilyName)
12070 {
12071 case SPELLFAMILY_MAGE:
12072 // Glyph of Fire Blast
12073 if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12)
12075 if (AuraEffect const* aurEff = caster->GetAuraEffect(56369, EFFECT_0))
12076 crit_chance += aurEff->GetAmount();
12077 break;
12078 case SPELLFAMILY_DRUID:
12079 // Improved Faerie Fire
12081 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 109, 0))
12082 crit_chance += aurEff->GetAmount();
12083
12084 // cumulative effect - don't break
12085
12086 // Starfire
12087 if (spellProto->SpellFamilyFlags[0] & 0x4 && spellProto->SpellIconID == 1485)
12088 {
12089 // Improved Insect Swarm
12090 if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
12092 crit_chance += aurEff->GetAmount();
12093 break;
12094 }
12095 break;
12096 case SPELLFAMILY_ROGUE:
12097 // Shiv-applied poisons can't crit
12098 if (caster->FindCurrentSpellBySpellId(5938))
12099 crit_chance = 0.0f;
12100 break;
12102 // Flash of light
12103 if (spellProto->SpellFamilyFlags[0] & 0x40000000)
12104 {
12105 // Sacred Shield
12106 if (AuraEffect const* aura = GetAuraEffect(58597, 1, GetGUID()))
12107 crit_chance += aura->GetAmount();
12108 break;
12109 }
12110 // Exorcism
12111 else if (spellProto->GetCategory() == 19)
12112 {
12114 return 100.0f;
12115 break;
12116 }
12117 break;
12118 case SPELLFAMILY_SHAMAN:
12119 // Lava Burst
12120 if (spellProto->SpellFamilyFlags[1] & 0x00001000)
12121 {
12122 if (GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0, 0, caster->GetGUID()))
12124 return 100.0f;
12125 break;
12126 }
12127 break;
12128 }
12129 }
12130 break;
12131 }
12133 // Custom crit by class
12134 if (caster)
12135 {
12136 switch (spellProto->SpellFamilyName)
12137 {
12138 case SPELLFAMILY_DRUID:
12139 // Rend and Tear - bonus crit chance for Ferocious Bite on bleeding targets
12140 if (spellProto->SpellFamilyFlags[0] & 0x00800000 && spellProto->SpellIconID == 1680 && HasAuraState(AURA_STATE_BLEEDING))
12141 {
12142 if (AuraEffect const* rendAndTear = caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 1))
12143 crit_chance += rendAndTear->GetAmount();
12144 break;
12145 }
12146 break;
12148 // Victory Rush
12149 if (spellProto->SpellFamilyFlags[1] & 0x100)
12150 {
12151 // Glyph of Victory Rush
12152 if (AuraEffect const* aurEff = caster->GetAuraEffect(58382, 0))
12153 crit_chance += aurEff->GetAmount();
12154 break;
12155 }
12156 break;
12157 }
12158 }
12159
12160 // 100% critical chance against sitting target
12162 {
12163 return 100.0f;
12164 }
12165 [[fallthrough]];
12167 {
12168 // flat aura mods
12169 if (attackType == RANGED_ATTACK)
12171 else
12173
12174 // reduce crit chance from Rating for players
12175 if (attackType != RANGED_ATTACK)
12176 {
12177 // xinef: little hack, crit chance dont require caster to calculate, pass victim
12178 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_MELEE);
12179 }
12180 else
12181 Unit::ApplyResilience(this, &crit_chance, nullptr, false, CR_CRIT_TAKEN_RANGED);
12182
12183 // Apply crit chance from defence skill
12184 if (caster)
12185 crit_chance += (int32(caster->GetMaxSkillValueForLevel(this)) - int32(GetDefenseSkillValue(caster))) * 0.04f;
12186
12187 break;
12188 }
12189 // values overridden in spellmgr for lifebloom and earth shield
12191 default:
12192 return 0.0f;
12193 }
12194
12195 if (caster)
12196 {
12198 for (AuraEffectList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
12199 {
12200 if (caster->GetGUID() != (*i)->GetCasterGUID())
12201 continue;
12202
12203 crit_chance += (*i)->GetAmount();
12204 }
12205 }
12206
12207 // Modify critical chance by victim SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE
12208 // xinef: should be calculated at the end
12209 if (!spellProto->IsPositive())
12211
12212 // xinef: can be negative!
12213 return crit_chance;
12214}
@ SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
Definition: SpellAuraDefines.h:242
uint32 const CREATURE_TYPEMASK_DEMON_OR_UNDEAD
Definition: SharedDefines.h:2643
@ MECHANIC_KNOCKOUT
Definition: SharedDefines.h:1339
@ AURA_STATE_BLEEDING
Definition: SharedDefines.h:1310
@ AURA_STATE_FAERIE_FIRE
Definition: SharedDefines.h:1304
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask, const AuraEffect *except=nullptr) const
Definition: Unit.cpp:5937
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const
Definition: Unit.cpp:5951

References ApplyResilience(), AURA_STATE_BLEEDING, AURA_STATE_FAERIE_FIRE, AURA_STATE_FROZEN, AURA_STATE_HEALTHLESS_35_PERCENT, CR_CRIT_TAKEN_MELEE, CR_CRIT_TAKEN_RANGED, CR_CRIT_TAKEN_SPELL, CREATURE_TYPEMASK_DEMON_OR_UNDEAD, SpellInfo::DmgClass, EFFECT_0, FindCurrentSpellBySpellId(), GetAuraEffect(), GetAuraEffectsByType(), SpellInfo::GetCategory(), GetCreatureTypeMask(), GetDefenseSkillValue(), GetDummyAuraEffect(), Object::GetGUID(), GetMaxNegativeAuraModifierByMiscMask(), GetMaxPositiveAuraModifierByMiscMask(), GetMaxSkillValueForLevel(), getStandState(), GetTotalAuraModifier(), SpellInfo::HasAttribute(), HasAura(), HasAuraState(), HasAuraType(), HasAuraWithMechanic(), SpellInfo::IsCritCapable(), Object::IsPlayer(), SpellInfo::IsPositive(), IsSitState(), MECHANIC_KNOCKOUT, MECHANIC_STUN, RANGED_ATTACK, SPELL_ATTR2_CANT_CRIT, SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE, SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELL_AURA_OVERRIDE_CLASS_SCRIPTS, SPELL_AURA_PERIODIC_DAMAGE, SPELL_DAMAGE_CLASS_MAGIC, SPELL_DAMAGE_CLASS_MELEE, SPELL_DAMAGE_CLASS_NONE, SPELL_DAMAGE_CLASS_RANGED, SPELLFAMILY_DRUID, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARRIOR, SpellInfo::SpellFamilyFlags, SpellInfo::SpellFamilyName, SpellInfo::SpellIconID, and UNIT_STAND_STATE_SLEEP.

Referenced by AuraEffect::CalcPeriodicCritChance(), and Spell::DoAllEffectOnLaunchTarget().

◆ StartReactiveTimer()

void Unit::StartReactiveTimer ( ReactiveType  reactive)
inline
#define REACTIVE_TIMER_START
Definition: Unit.h:584

References m_reactiveTimer, and REACTIVE_TIMER_START.

Referenced by ProcDamageAndSpellFor().

◆ StopAttackFaction()

void Unit::StopAttackFaction ( uint32  faction_id)
20087{
20088 if (Unit* victim = GetVictim())
20089 {
20090 if (victim->GetFactionTemplateEntry()->faction == faction_id)
20091 {
20092 AttackStop();
20093 if (IsNonMeleeSpellCast(false))
20095
20096 // melee and ranged forced attack cancel
20097 if (IsPlayer())
20099 }
20100 }
20101
20102 AttackerSet const& attackers = getAttackers();
20103 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
20104 {
20105 if ((*itr)->GetFactionTemplateEntry()->faction == faction_id)
20106 {
20107 (*itr)->AttackStop();
20108 itr = attackers.begin();
20109 }
20110 else
20111 ++itr;
20112 }
20113
20115
20116 for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
20117 (*itr)->StopAttackFaction(faction_id);
20118}
void deleteReferencesForFaction(uint32 faction)
Definition: HostileRefMgr.cpp:162

References AttackStop(), HostileRefMgr::deleteReferencesForFaction(), getAttackers(), getHostileRefMgr(), GetVictim(), InterruptNonMeleeSpells(), IsNonMeleeSpellCast(), Object::IsPlayer(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by AuraEffect::HandleForceReaction().

◆ StopAttackingInvalidTarget()

void Unit::StopAttackingInvalidTarget ( )
20121{
20122 AttackerSet const& attackers = getAttackers();
20123 for (AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
20124 {
20125 Unit* attacker = (*itr);
20126 if (!attacker->IsValidAttackTarget(this))
20127 {
20128 attacker->AttackStop();
20129 if (attacker->IsPlayer())
20130 {
20132 }
20133
20134 for (Unit* controled : attacker->m_Controlled)
20135 {
20136 if (controled->GetVictim() == this && !controled->IsValidAttackTarget(this))
20137 {
20138 controled->AttackStop();
20139 }
20140 }
20141
20142 itr = attackers.begin();
20143 }
20144 else
20145 {
20146 ++itr;
20147 }
20148 }
20149}

References AttackStop(), getAttackers(), GetVictim(), Object::IsPlayer(), IsValidAttackTarget(), m_Controlled, Player::SendAttackSwingCancelAttack(), and Object::ToPlayer().

Referenced by RemoveCharmedBy(), and SetCharmedBy().

◆ StopMoving()

void Unit::StopMoving ( )
16579{
16581
16582 // not need send any packets if not in world or not moving
16583 if (!IsInWorld())
16584 return;
16585
16586 if (movespline->Finalized())
16587 return;
16588
16589 // Update position now since Stop does not start a new movement that can be updated later
16590 if (movespline->HasStarted())
16592
16593 Movement::MoveSplineInit init(this);
16594 init.Stop();
16595}
void UpdateSplinePosition()
Definition: Unit.cpp:608
bool HasStarted() const
Definition: MoveSpline.h:129

References ClearUnitState(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::HasStarted(), Object::IsInWorld(), movespline, Movement::MoveSplineInit::Stop(), UNIT_STATE_MOVING, and UpdateSplinePosition().

Referenced by npc_escortAI::AttackStart(), SmartAI::AttackStart(), boss_baron_geddon::boss_baron_geddonAI::DamageTaken(), boss_grand_champion::boss_grand_championAI::DamageTaken(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_ingvar_the_plunderer::boss_ingvar_the_plundererAI::DamageTaken(), npc_vrykul_skeleton::npc_vrykul_skeletonAI::DamageTaken(), npc_blistering_zombie::npc_blistering_zombieAI::DamageTaken(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::DoAction(), npc_kinetic_bomb::npc_kinetic_bombAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), ScriptedAI::DoCastSpell(), FlightPathMovementGenerator::DoFinalize(), FleeingMovementGenerator< T >::DoFinalize(), ConfusedMovementGenerator< T >::DoFinalize(), npc_taskmaster_fizzule::npc_taskmaster_fizzuleAI::DoFriend(), ChaseMovementGenerator< T >::DoInitialize(), WaypointMovementGenerator< Creature >::DoUpdate(), RandomMovementGenerator< T >::DoUpdate(), ChaseMovementGenerator< T >::DoUpdate(), FollowMovementGenerator< T >::DoUpdate(), boss_blood_queen_lana_thel::boss_blood_queen_lana_thelAI::GoToMinchar(), debug_commandscript::HandleDebugMoveflagsCommand(), WorldSession::HandlePetActionHelper(), RotateMovementGenerator::Initialize(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::IsSummonedBy(), boss_kologarn::boss_kologarnAI::JustDied(), boss_swamplord_muselek::JustEngagedWith(), Player::LeaveBattleground(), SmartAI::MoveAway(), boss_headless_horseman::MovementInform(), boss_jedoga_shadowseeker::MovementInform(), boss_ghazan::MovementInform(), npc_ball_of_flame::npc_ball_of_flameAI::MovementInform(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::OnCharmed(), PauseMovement(), SmartAI::PausePath(), npc_hidden_cultist::npc_hidden_cultistAI::PreScript(), RemoveCharmedBy(), Creature::RemoveCorpse(), npc_xt002_scrapbot::npc_xt002_scrapbotAI::Reset(), npc_xt002_boombot::npc_xt002_boombotAI::Reset(), boss_leotheras_the_blind::Reset(), IdleMovementGenerator::Reset(), npc_putricide_oozeAI::SelectNewTarget(), npc_icc_ice_sphere::npc_icc_ice_sphereAI::SelectNewTarget(), SetCharmedBy(), SmartAI::SetCombatMove(), SetConfused(), boss_victor_nefarius::boss_victor_nefariusAI::SetData(), setDeathState(), SetFeared(), FollowerAI::SetFollowComplete(), FollowerAI::SetFollowPaused(), SetRooted(), npc_magister_aledis::sGossipSelect(), npc_cult_fanatic::npc_cult_fanaticAI::SpellHit(), npc_cult_adherent::npc_cult_adherentAI::SpellHit(), npc_tirion_fordring_tft::npc_tirion_fordringAI::SpellHit(), boss_urom::boss_uromAI::SpellHit(), npc_vengeful_shade::npc_vengeful_shadeAI::SpellHitTarget(), boss_heigan::boss_heiganAI::StartFightPhase(), SmartAI::StopFollow(), SmartAI::StopPath(), CreatureAI::TriggerAlert(), Pet::Update(), TimedFleeingMovementGenerator::Update(), boss_felblood_kaelthas::UpdateAI(), boss_felmyst::boss_felmystAI::UpdateAI(), boss_akilzon::boss_akilzonAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_onyxia::UpdateAI(), boss_grand_champion::boss_grand_championAI::UpdateAI(), boss_jormungarAI::UpdateAI(), boss_icehowl::boss_icehowlAI::UpdateAI(), npc_hor_lich_king::npc_hor_lich_kingAI::UpdateAI(), npc_kinetic_bomb::npc_kinetic_bombAI::UpdateAI(), boss_lord_marrowgar::UpdateAI(), boss_sindragosa::boss_sindragosaAI::UpdateAI(), npc_rimefang::npc_rimefangAI::UpdateAI(), npc_valithria_cloud::npc_valithria_cloudAI::UpdateAI(), boss_malygos::boss_malygosAI::UpdateAI(), boss_stormcaller_brundir::boss_stormcaller_brundirAI::UpdateAI(), boss_mimiron::boss_mimironAI::UpdateAI(), boss_razorscale::boss_razorscaleAI::UpdateAI(), boss_thorim_sif::boss_thorim_sifAI::UpdateAI(), npc_mature_netherwing_drake::npc_mature_netherwing_drakeAI::UpdateAI(), npc_pet_gen_plump_turkey::UpdateAI(), and PetAI::UpdateAI().

◆ StopMovingOnCurrentPos()

void Unit::StopMovingOnCurrentPos ( )
16618{
16620
16621 // not need send any packets if not in world
16622 if (!IsInWorld())
16623 return;
16624
16625 DisableSpline(); // pussywizard: required so Launch() won't recalculate position from previous spline
16626 Movement::MoveSplineInit init(this);
16627 init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ());
16628 init.SetFacing(GetOrientation());
16629 init.Launch();
16630}

References ClearUnitState(), DisableSpline(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::IsInWorld(), Movement::MoveSplineInit::Launch(), Movement::MoveSplineInit::MoveTo(), Movement::MoveSplineInit::SetFacing(), and UNIT_STATE_MOVING.

Referenced by npc_mograine::npc_mograineAI::AshbringerEvent(), npc_high_overlord_saurfang_icc::npc_high_overlord_saurfangAI::DoAction(), npc_muradin_bronzebeard_icc::npc_muradin_bronzebeard_iccAI::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), UtherBatteredHiltEvent::Execute(), WorldSession::HandlePetActionHelper(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), npc_escortAI::MovementInform(), SmartAI::MovepointReached(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_ulduar::instance_ulduar_InstanceMapScript::OnCreatureCreate(), boss_skadi::boss_skadiAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), SetRooted(), boss_hexlord_malacrass::boss_hex_lord_malacrassAI::SpawnAdds(), boss_devourer_of_souls::boss_devourer_of_soulsAI::SpellHitTarget(), Creature::Update(), npc_rookery_hatcher::npc_rookery_hatcherAI::UpdateAI(), npc_vaelastrasz_the_red::npc_vaelastrasz_the_redAI::UpdateAI(), boss_janalai::boss_janalaiAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), and boss_illidan_stormrage::boss_illidan_stormrageAI::UpdateAI().

◆ Talk() [1/2]

void Unit::Talk ( std::string_view  text,
ChatMsg  msgType,
Language  language,
float  textRange,
WorldObject const *  target 
)
virtual
21035{
21036 Acore::CustomChatTextBuilder builder(this, msgType, text, language, target);
21039 Cell::VisitWorldObjects(this, worker, textRange);
21040}
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:193
Definition: GridNotifiers.h:592
Definition: GridNotifiers.h:1707
Definition: ChatTextBuilder.h:49

References Cell::VisitWorldObjects().

Referenced by spell_inoculate_nestlewood_owlkin::HandleEffectRemove(), and spell_the_flag_of_ownership::HandleScript().

◆ Talk() [2/2]

void Unit::Talk ( uint32  textId,
ChatMsg  msgType,
float  textRange,
WorldObject const *  target 
)
virtual
21071{
21072 if (!sObjectMgr->GetBroadcastText(textId))
21073 {
21074 LOG_ERROR("entities.unit", "Unit::Talk: `broadcast_text` (ID: {}) was not found", textId);
21075 return;
21076 }
21077
21078 Acore::BroadcastTextBuilder builder(this, msgType, textId, getGender(), target);
21081 Cell::VisitWorldObjects(this, worker, textRange);
21082}
Definition: ChatTextBuilder.h:31

References getGender(), LOG_ERROR, sObjectMgr, and Cell::VisitWorldObjects().

◆ TauntApply()

void Unit::TauntApply ( Unit victim)
14592{
14594
14595 if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster()))
14596 return;
14597
14598 if (!CanHaveThreatList())
14599 return;
14600
14601 Creature* creature = ToCreature();
14602
14603 if (creature->HasReactState(REACT_PASSIVE))
14604 return;
14605
14606 Unit* target = GetVictim();
14607 if (target && target == taunter)
14608 return;
14609
14610 SetInFront(taunter);
14611 SetGuidValue(UNIT_FIELD_TARGET, taunter->GetGUID());
14612
14613 if (creature->IsAIEnabled)
14614 creature->AI()->AttackStart(taunter);
14615
14616 //m_ThreatMgr.tauntApply(taunter);
14617}
void SetInFront(WorldObject const *target)
Definition: Unit.cpp:20424

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), Object::GetGUID(), Object::GetTypeId(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Player::IsGameMaster(), Object::IsPlayer(), REACT_PASSIVE, Object::SetGuidValue(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), TYPEID_UNIT, and UNIT_FIELD_TARGET.

Referenced by AuraEffect::HandleModTaunt(), and boss_razorgore::boss_razorgoreAI::OnCharmed().

◆ TauntFadeOut()

void Unit::TauntFadeOut ( Unit taunter)
14622{
14624
14625 if (!taunter || (taunter->IsPlayer() && taunter->ToPlayer()->IsGameMaster()))
14626 return;
14627
14628 if (!CanHaveThreatList())
14629 return;
14630
14631 Creature* creature = ToCreature();
14632
14633 if (creature->HasReactState(REACT_PASSIVE))
14634 return;
14635
14636 Unit* target = GetVictim();
14637 if (!target || target != taunter)
14638 return;
14639
14641 {
14642 if (creature->IsAIEnabled)
14644 return;
14645 }
14646
14647 target = creature->SelectVictim(); // might have more taunt auras remaining
14648
14649 if (target && target != taunter)
14650 {
14652 SetInFront(target);
14653 if (creature->IsAIEnabled)
14654 creature->AI()->AttackStart(target);
14655 }
14656}
@ EVADE_REASON_NO_HOSTILES
Definition: CreatureAI.h:90
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:197
bool isThreatListEmpty() const
Definition: ThreatMgr.h:225
Unit * SelectVictim()
Definition: Unit.cpp:14660

References Creature::AI(), ASSERT, UnitAI::AttackStart(), CanHaveThreatList(), CreatureAI::EnterEvadeMode(), CreatureAI::EVADE_REASON_NO_HOSTILES, Object::GetGUID(), Object::GetTypeId(), GetVictim(), Creature::HasReactState(), IsAIEnabled, Player::IsGameMaster(), Object::IsPlayer(), ThreatMgr::isThreatListEmpty(), m_ThreatMgr, REACT_PASSIVE, Creature::SelectVictim(), Object::SetGuidValue(), SetInFront(), Object::ToCreature(), Object::ToPlayer(), TYPEID_UNIT, and UNIT_FIELD_TARGET.

Referenced by AuraEffect::HandleModTaunt(), and npc_deaths_fel_cannon::npc_deaths_fel_cannonAI::UpdateAI().

◆ TextEmote() [1/2]

◆ TextEmote() [2/2]

void Unit::TextEmote ( uint32  textId,
WorldObject const *  target = nullptr,
bool  isBossEmote = false 
)
virtual

Reimplemented in Player.

21095{
21096 Talk(textId, isBossEmote ? CHAT_MSG_RAID_BOSS_EMOTE : CHAT_MSG_MONSTER_EMOTE, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), target);
21097}

References CHAT_MSG_MONSTER_EMOTE, CHAT_MSG_RAID_BOSS_EMOTE, CONFIG_LISTEN_RANGE_TEXTEMOTE, and sWorld.

◆ ToPet()

◆ ToTempSummon() [1/2]

TempSummon * Unit::ToTempSummon ( )
inline
1743{ if (IsSummon()) return reinterpret_cast<TempSummon*>(this); else return nullptr; }

References IsSummon().

Referenced by CreatureAI::_EnterEvadeMode(), _ExitVehicle(), npc_living_mojo::npc_living_mojoAI::AttackStart(), WorldObject::CanSeeOrDetect(), Spell::CheckCast(), Spell::CheckEffectTarget(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::DamageTaken(), npc_tiger_matriarch::npc_tiger_matriarchAI::DamageTaken(), Creature::DespawnOnEvade(), Creature::DespawnOrUnsummon(), npc_bone_spike::npc_bone_spikeAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::DoAction(), ThreatMgr::DoAddThreat(), Spell::EffectScriptEffect(), npc_phantom_hallucination::npc_phantom_hallucinationAI::EnterEvadeMode(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::EnterEvadeMode(), SuckBackEvent::Execute(), npc_raging_flames::FixateRandomTarget(), boss_headless_horseman_head::GetOwner(), GetSpellModOwner(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner(), Creature::GetSummonerGUID(), SmartScript::GetTargets(), WorldSession::HandleDismissCritter(), spell_pilgrims_bounty_pass_generic::HandleDummy(), WorldSession::HandlePetActionHelper(), spell_pri_lightwell::HandleScriptEffect(), spell_q11026_a11051_banish_the_demons::HandleScriptEffect(), npc_hourglass_of_eternity::npc_hourglass_of_eternityAI::InitializeAI(), npc_bushwhacker::npc_bushwhackerAI::InitializeAI(), npc_pet_gen_imp_in_a_bottle::InitializeAI(), npc_pet_pri_lightwell::InitializeAI(), TempSummon::InitStats(), SpellClickInfo::IsFitToRequirements(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::JustDied(), boss_black_knight::boss_black_knightAI::JustDied(), boss_tyrannus::boss_tyrannusAI::JustDied(), npc_raging_spirit::npc_raging_spiritAI::JustDied(), boss_freya_iron_root::boss_freya_iron_rootAI::JustDied(), boss_yoggsaron_influence_tentacle::boss_yoggsaron_influence_tentacleAI::JustDied(), npc_counselor_talbot::npc_counselor_talbotAI::JustDied(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::JustDied(), boss_essence_of_anger::boss_essence_of_angerAI::JustDied(), npc_pet_dk_ghoul::npc_pet_dk_ghoulAI::JustDied(), npc_pet_pri_shadowfiend::JustDied(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::JustEngagedWith(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::JustEngagedWith(), boss_yoggsaron_cloud::boss_yoggsaron_cloudAI::JustSummoned(), npc_frosthound::npc_frosthoundAI::JustSummoned(), boss_halion::boss_halionAI::JustSummoned(), boss_lady_deathwhisper::boss_lady_deathwhisperAI::JustSummoned(), npc_collapsing_star::npc_collapsing_starAI::JustSummoned(), npc_algalon_worm_hole::npc_algalon_worm_holeAI::JustSummoned(), boss_supremus::JustSummoned(), Kill(), npc_tiger_matriarch::npc_tiger_matriarchAI::KilledUnit(), npc_netherspite_infernal::KilledUnit(), npc_living_mojo::npc_living_mojoAI::MoveInLineOfSight(), WaypointMovementGenerator< Creature >::MovementInform(), npc_frostbrood_skytalon::npc_frostbrood_skytalonAI::MovementInform(), npc_leryssa::npc_leryssaAI::MovementInform(), npc_injured_7th_legion_soldier::npc_injured_7th_legion_soldierAI::MovementInform(), npc_balance_of_light_and_shadow::npc_balance_of_light_and_shadowAI::MovementInform(), npc_marzon_silent_blade::npc_marzon_silent_bladeAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::MovementInform(), npc_attracted_reef_bull::npc_attracted_reef_bullAI::npc_attracted_reef_bullAI(), npc_batrider::npc_batrider(), npc_claw_tentacle::npc_claw_tentacle(), npc_eye_tentacle::npc_eye_tentacle(), npc_frost_tomb::npc_frost_tombAI::npc_frost_tombAI(), npc_giant_claw_tentacle::npc_giant_claw_tentacle(), npc_giant_eye_tentacle::npc_giant_eye_tentacle(), npc_midsummer_bonfire::npc_midsummer_bonfire(), npc_midsummer_ribbon_pole_target::npc_midsummer_ribbon_pole_target(), npc_pet_gen_soul_trader_beacon::npc_pet_gen_soul_trader_beacon(), BattlefieldWG::OnCreatureCreate(), instance_blackwing_lair::instance_blackwing_lair_InstanceMapScript::OnCreatureCreate(), npc_wormhole::OnGossipHello(), RemoveAllControlled(), RemoveAllMinionsByEntry(), spell_gen_defend::RemoveDummyFromDriver(), npc_anub_ar_crusher::npc_anub_ar_crusherAI::Reset(), npc_raging_spirit::npc_raging_spiritAI::Reset(), npc_stormforged_lieutenant::npc_stormforged_lieutenantAI::Reset(), npc_future_you::npc_future_youAI::Reset(), npc_plaguehound_tracker::npc_plaguehound_trackerAI::Reset(), npc_voidtraveler::Reset(), npc_pet_gen_argent_pony_bridle::Reset(), Spell::SelectImplicitCasterObjectTargets(), Creature::SelectVictim(), Spell::SendSpellGo(), Spell::SendSpellStart(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_ulduar_flames_spread::npc_ulduar_flames_spreadAI::SpellHit(), npc_pilgrims_bounty_plate::SpellHit(), boss_the_lich_king::boss_the_lich_kingAI::SummonedCreatureDies(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::Update(), npc_valkyr_battle_maiden::npc_valkyr_battle_maidenAI::UpdateAI(), npc_love_in_air_snivel_real::UpdateAI(), npc_tiger_matriarch_credit::npc_tiger_matriarch_creditAI::UpdateAI(), npc_tiger_matriarch::npc_tiger_matriarchAI::UpdateAI(), npc_living_mojo::npc_living_mojoAI::UpdateAI(), npc_bone_spike::npc_bone_spikeAI::UpdateAI(), npc_little_ooze::npc_little_oozeAI::UpdateAI(), npc_raging_spirit::npc_raging_spiritAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_freya_ward::npc_freya_wardAI::UpdateAI(), npc_ulduar_flash_freeze::npc_ulduar_flash_freezeAI::UpdateAI(), npc_vh_void_sentry::npc_vh_void_sentryAI::UpdateAI(), npc_captured_beryl_sorcerer::npc_captured_beryl_sorcererAI::UpdateAI(), npc_feedin_da_goolz::npc_feedin_da_goolzAI::UpdateAI(), Player::VehicleSpellInitialize(), and npc_frosthound::npc_frosthoundAI::WaypointReached().

◆ ToTempSummon() [2/2]

const TempSummon * Unit::ToTempSummon ( ) const
inline
1744{ if (IsSummon()) return reinterpret_cast<const TempSummon*>(this); else return nullptr; }

References IsSummon().

◆ ToTotem()

Totem * Unit::ToTotem ( )
inline
1742{ if (IsTotem()) return reinterpret_cast<Totem*>(this); else return nullptr; }
Definition: Totem.h:51

References IsTotem().

Referenced by _UnapplyAura(), Spell::EffectDestroyAllTotems(), WorldSession::HandleTotemDestroyed(), SetMinion(), Spell::SummonGuardian(), and TotemAI::UpdateAI().

◆ TriggerAurasProcOnEvent() [1/3]

void Unit::TriggerAurasProcOnEvent ( CalcDamageInfo damageInfo)
16472{
16473 DamageInfo dmgInfo = DamageInfo(damageInfo);
16474 TriggerAurasProcOnEvent(nullptr, nullptr, damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, 0, 0, damageInfo.procEx, nullptr, &dmgInfo, nullptr);
16475}
void TriggerAurasProcOnEvent(CalcDamageInfo &damageInfo)
Definition: Unit.cpp:16471

References CalcDamageInfo::procAttacker, CalcDamageInfo::procEx, CalcDamageInfo::procVictim, CalcDamageInfo::target, and TriggerAurasProcOnEvent().

Referenced by TriggerAurasProcOnEvent().

◆ TriggerAurasProcOnEvent() [2/3]

void Unit::TriggerAurasProcOnEvent ( ProcEventInfo eventInfo,
std::list< AuraApplication * > &  procAuras 
)
16497{
16498 for (std::list<AuraApplication*>::iterator itr = aurasTriggeringProc.begin(); itr != aurasTriggeringProc.end(); ++itr)
16499 {
16500 if (!(*itr)->GetRemoveMode())
16501 (*itr)->GetBase()->TriggerProcOnEvent(*itr, eventInfo);
16502 }
16503}

◆ TriggerAurasProcOnEvent() [3/3]

void Unit::TriggerAurasProcOnEvent ( std::list< AuraApplication * > *  myProcAuras,
std::list< AuraApplication * > *  targetProcAuras,
Unit actionTarget,
uint32  typeMaskActor,
uint32  typeMaskActionTarget,
uint32  spellTypeMask,
uint32  spellPhaseMask,
uint32  hitMask,
Spell spell,
DamageInfo damageInfo,
HealInfo healInfo 
)
16478{
16479 // prepare data for self trigger
16480 ProcEventInfo myProcEventInfo = ProcEventInfo(this, actionTarget, actionTarget, typeMaskActor, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
16481 std::list<AuraApplication*> myAurasTriggeringProc;
16482 GetProcAurasTriggeredOnEvent(myAurasTriggeringProc, myProcAuras, myProcEventInfo);
16483
16484 // prepare data for target trigger
16485 ProcEventInfo targetProcEventInfo = ProcEventInfo(this, actionTarget, this, typeMaskActionTarget, spellTypeMask, spellPhaseMask, hitMask, spell, damageInfo, healInfo);
16486 std::list<AuraApplication*> targetAurasTriggeringProc;
16487 if (typeMaskActionTarget)
16488 GetProcAurasTriggeredOnEvent(targetAurasTriggeringProc, targetProcAuras, targetProcEventInfo);
16489
16490 TriggerAurasProcOnEvent(myProcEventInfo, myAurasTriggeringProc);
16491
16492 if (typeMaskActionTarget)
16493 TriggerAurasProcOnEvent(targetProcEventInfo, targetAurasTriggeringProc);
16494}
void GetProcAurasTriggeredOnEvent(std::list< AuraApplication * > &aurasTriggeringProc, std::list< AuraApplication * > *procAuras, ProcEventInfo eventInfo)
Definition: Unit.cpp:16441

References GetProcAurasTriggeredOnEvent(), and TriggerAurasProcOnEvent().

◆ UnsummonAllTotems()

void Unit::UnsummonAllTotems ( bool  onDeath = false)
11141{
11142 for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
11143 {
11144 if (!m_SummonSlot[i])
11145 {
11146 continue;
11147 }
11148
11149 if (Creature* OldTotem = GetMap()->GetCreature(m_SummonSlot[i]))
11150 {
11151 if (OldTotem->IsSummon())
11152 {
11153 if (!(onDeath && !IsPlayer() && OldTotem->IsGuardian()))
11154 {
11155 OldTotem->ToTempSummon()->UnSummon();
11156 }
11157 }
11158 }
11159 }
11160}

References WorldObject::GetMap(), Object::IsPlayer(), m_SummonSlot, and MAX_SUMMON_SLOT.

Referenced by Player::ActivateSpec(), RemoveFromWorld(), and setDeathState().

◆ Update()

void Unit::Update ( uint32  time)
overridevirtual

Reimplemented from WorldObject.

384{
385 sScriptMgr->OnUnitUpdate(this, p_time);
386
387 // WARNING! Order of execution here is important, do not change.
388 // Spells must be processed with event system BEFORE they go to _UpdateSpells.
389 // Or else we may have some SPELL_STATE_FINISHED spells stalled in pointers, that is bad.
390 m_Events.Update(p_time);
391
392 if (!IsInWorld())
393 return;
394
395 // pussywizard:
396 if (GetTypeId() != TYPEID_PLAYER || (!ToPlayer()->IsBeingTeleported() && !bRequestForcedVisibilityUpdate))
397 {
399 {
401 {
403 //ExecuteDelayedUnitRelocationEvent();
405 }
406 else
408 }
410 {
411 if (m_delayed_unit_ai_notify_timer <= p_time)
412 {
415 }
416 else
418 }
419 }
420
421 _UpdateSpells( p_time );
422
423 if (CanHaveThreatList() && GetThreatMgr().isNeedUpdateToClient(p_time))
425
426 // update combat timer only for players and pets (only pets with PetAI)
428 {
429 // Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
430 // targets without stopping half way there and running off.
431 // These flags are reset after target dies or another command is given.
433 {
434 // m_CombatTimer set at aura start and it will be freeze until aura removing
435 if (m_CombatTimer <= p_time)
437 else
438 m_CombatTimer -= p_time;
439 }
440 }
441
444 {
445 while (!extraAttacksTargets.empty())
446 {
447 auto itr = extraAttacksTargets.begin();
448 ObjectGuid targetGuid = itr->first;
449 uint32 count = itr->second;
450 extraAttacksTargets.erase(itr);
451 if (Unit* victim = ObjectAccessor::GetUnit(*this, targetGuid))
452 {
454 || victim->IsWithinMeleeRange(this))
455 {
456 HandleProcExtraAttackFor(victim, count);
457 }
458 }
459 }
461 }
462
463 // not implemented before 3.0.2
464 // xinef: if attack time > 0, reduce by diff
465 // if on next update, attack time < 0 assume player didnt attack - set to 0
466 bool suspendAttackTimer = false;
467 bool suspendRangedAttackTimer = false;
469 {
470 for (Spell* spell : m_currentSpells)
471 {
472 if (spell)
473 {
474 if (spell->GetSpellInfo()->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
475 {
476 if (spell->IsChannelActive())
477 {
478 suspendRangedAttackTimer = true;
479 }
480
481 suspendAttackTimer = true;
482 break;
483 }
484 }
485 }
486 }
487
488 if (!suspendAttackTimer)
489 {
490 if (int32 base_attack = getAttackTimer(BASE_ATTACK))
491 {
492 setAttackTimer(BASE_ATTACK, base_attack > 0 ? base_attack - (int32) p_time : 0);
493 }
494
495 if (int32 off_attack = getAttackTimer(OFF_ATTACK))
496 {
497 setAttackTimer(OFF_ATTACK, off_attack > 0 ? off_attack - (int32) p_time : 0);
498 }
499 }
500
501 if (!suspendRangedAttackTimer)
502 {
503 if (int32 ranged_attack = getAttackTimer(RANGED_ATTACK))
504 {
505 setAttackTimer(RANGED_ATTACK, ranged_attack > 0 ? ranged_attack - (int32)p_time : 0);
506 }
507 }
508
509 // update abilities available only for fraction of time
510 UpdateReactives(p_time);
511
515
516 UpdateSplineMovement(p_time);
517 GetMotionMaster()->UpdateMotion(p_time);
518
520}
@ AURA_STATE_HEALTH_ABOVE_75_PERCENT
Definition: SharedDefines.h:1315
bool IsEmpty() const
Definition: LinkedList.h:97
void Update(uint32 p_time)
Definition: EventProcessor.cpp:40
void _UpdateSpells(uint32 time)
Definition: Unit.cpp:3811
void UpdateSplineMovement(uint32 t_diff)
Definition: Unit.cpp:576
void UpdateReactives(uint32 p_time)
Definition: Unit.cpp:16868
void ExecuteDelayedUnitAINotifyEvent()
Definition: Unit.cpp:20413
void HandleProcExtraAttackFor(Unit *victim, uint32 count)
Definition: Unit.cpp:2723
void SendThreatListUpdate()
Definition: Unit.cpp:19997
std::unordered_set< Unit * > i_objectsForDelayedVisibility
Definition: Map.h:389
void UpdateMotion(uint32 diff)
Definition: MotionMaster.cpp:104

References _lastDamagedTargetGuid, _lastExtraAttackSpell, _UpdateSpells(), AURA_STATE_HEALTH_ABOVE_75_PERCENT, AURA_STATE_HEALTHLESS_20_PERCENT, AURA_STATE_HEALTHLESS_35_PERCENT, BASE_ATTACK, bRequestForcedVisibilityUpdate, CanHaveThreatList(), ClearInCombat(), ObjectGuid::Empty, ExecuteDelayedUnitAINotifyEvent(), extraAttacksTargets, WorldObject::FindMap(), getAttackTimer(), GetMotionMaster(), GetThreatMgr(), Object::GetTypeId(), ObjectAccessor::GetUnit(), HandleProcExtraAttackFor(), HasUnitState(), HasUnitTypeMask(), HealthAbovePct(), HealthBelowPct(), Map::i_objectsForDelayedVisibility, InvalidateValuesUpdateCache(), IsAlive(), IsControlledByPlayer(), LinkedListHead::IsEmpty(), IsInCombat(), Object::IsInWorld(), IsPet(), Object::IsPlayer(), m_CombatTimer, m_currentSpells, m_delayed_unit_ai_notify_timer, m_delayed_unit_relocation_timer, m_Events, m_HostileRefMgr, ModifyAuraState(), OFF_ATTACK, RANGED_ATTACK, SendThreatListUpdate(), setAttackTimer(), SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS, SPELL_HACK_AND_SLASH, SPELL_SWORD_SPECIALIZATION, sScriptMgr, Object::ToPlayer(), TYPEID_PLAYER, UNIT_MASK_CONTROLABLE_GUARDIAN, UNIT_STATE_CASTING, EventProcessor::Update(), MotionMaster::UpdateMotion(), UpdateReactives(), and UpdateSplineMovement().

Referenced by Creature::Update(), and Player::Update().

◆ UpdateAllResistances()

void Unit::UpdateAllResistances ( )
virtual

◆ UpdateAllStats()

virtual bool Unit::UpdateAllStats ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

◆ UpdateArmor()

virtual void Unit::UpdateArmor ( )
pure virtual

◆ UpdateAttackPowerAndDamage()

virtual void Unit::UpdateAttackPowerAndDamage ( bool  ranged = false)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateAuraForGroup()

void Unit::UpdateAuraForGroup ( uint8  slot)
17098{
17099 if (slot >= MAX_AURAS) // slot not found, return
17100 return;
17101 if (Player* player = ToPlayer())
17102 {
17103 if (player->GetGroup())
17104 {
17105 player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_AURAS);
17106 player->SetAuraUpdateMaskForRaid(slot);
17107 }
17108 }
17109 else if (GetTypeId() == TYPEID_UNIT && IsPet())
17110 {
17111 Pet* pet = ((Pet*)this);
17112 if (pet->isControlled())
17113 {
17114 Unit* owner = GetOwner();
17115 if (owner && (owner->IsPlayer()) && owner->ToPlayer()->GetGroup())
17116 {
17118 pet->SetAuraUpdateMaskForRaid(slot);
17119 }
17120 }
17121 }
17122}
@ GROUP_UPDATE_FLAG_PET_AURAS
Definition: Group.h:118
@ GROUP_UPDATE_FLAG_AURAS
Definition: Group.h:109
#define MAX_AURAS
Definition: SpellAuraDefines.h:21
void SetAuraUpdateMaskForRaid(uint8 slot)
Definition: Pet.h:137

References Player::GetGroup(), GetOwner(), Object::GetTypeId(), GROUP_UPDATE_FLAG_AURAS, GROUP_UPDATE_FLAG_PET_AURAS, Pet::isControlled(), IsPet(), Object::IsPlayer(), MAX_AURAS, Pet::SetAuraUpdateMaskForRaid(), Player::SetGroupUpdateFlag(), Object::ToPlayer(), and TYPEID_UNIT.

Referenced by RemoveVisibleAura(), and SetVisibleAura().

◆ UpdateCharmAI()

void Unit::UpdateCharmAI ( )
15713{
15714 if (IsPlayer())
15715 return;
15716
15717 if (i_disabledAI) // disabled AI must be primary AI
15718 {
15719 if (!IsCharmed())
15720 {
15721 delete i_AI;
15723 i_disabledAI = nullptr;
15724 }
15725 }
15726 else
15727 {
15728 if (IsCharmed())
15729 {
15731 if (isPossessed() || IsVehicle())
15732 i_AI = new PossessedAI(ToCreature());
15733 else
15734 i_AI = new PetAI(ToCreature());
15735 }
15736 }
15737}
Definition: PassiveAI.h:37
Definition: PetAI.h:47

References i_AI, i_disabledAI, IsCharmed(), Object::IsPlayer(), isPossessed(), IsVehicle(), and Object::ToCreature().

Referenced by Creature::Update().

◆ UpdateDamagePhysical()

void Unit::UpdateDamagePhysical ( WeaponAttackType  attType)
virtual

Reimplemented in Guardian, and Totem.

61{
62 float totalMin = 0.f;
63 float totalMax = 0.f;
64
65 float tmpMin, tmpMax;
66 for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i)
67 {
68 CalculateMinMaxDamage(attType, false, true, tmpMin, tmpMax, i);
69 totalMin += tmpMin;
70 totalMax += tmpMax;
71 }
72
73 switch (attType)
74 {
75 case BASE_ATTACK:
76 default:
79 break;
80 case OFF_ATTACK:
83 break;
84 case RANGED_ATTACK:
87 break;
88 }
89}
void SetStatFloatValue(uint16 index, float value)
Definition: Object.cpp:790

References BASE_ATTACK, CalculateMinMaxDamage(), MAX_ITEM_PROTO_DAMAGES, OFF_ATTACK, RANGED_ATTACK, Object::SetStatFloatValue(), UNIT_FIELD_MAXDAMAGE, UNIT_FIELD_MAXOFFHANDDAMAGE, UNIT_FIELD_MAXRANGEDDAMAGE, UNIT_FIELD_MINDAMAGE, UNIT_FIELD_MINOFFHANDDAMAGE, and UNIT_FIELD_MINRANGEDDAMAGE.

Referenced by Player::_ApplyAmmoBonuses(), Player::_ApplyWeaponDamage(), boss_twin_valkyrAI::boss_twin_valkyrAI(), AuraEffect::HandleAuraModDisarm(), AuraEffect::HandleModAttackSpeed(), HandleStatModifier(), npc_toc_enh_shaman::npc_toc_enh_shamanAI::npc_toc_enh_shamanAI(), Player::RemoveAmmo(), Creature::SetCanDualWield(), Creature::UpdateAttackPowerAndDamage(), and Player::UpdateAttackPowerAndDamage().

◆ UpdateHeight()

void Unit::UpdateHeight ( float  newZ)

Only server-side height update, does not broadcast to client.

19991{
19993 if (IsVehicle())
19995}
void RelocatePassengers()
Definition: Vehicle.cpp:496

References Position::GetPositionX(), Position::GetPositionY(), GetVehicleKit(), IsVehicle(), Position::Relocate(), and Vehicle::RelocatePassengers().

Referenced by npc_dancing_flames::npc_dancing_flamesAI::Reset(), and SetHover().

◆ UpdateInterruptMask()

void Unit::UpdateInterruptMask ( )
742{
743 m_interruptMask = 0;
744 for (AuraApplicationList::const_iterator i = m_interruptableAuras.begin(); i != m_interruptableAuras.end(); ++i)
745 m_interruptMask |= (*i)->GetBase()->GetSpellInfo()->AuraInterruptFlags;
746
748 if (spell->getState() == SPELL_STATE_CASTING)
749 m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
750}

References CURRENT_CHANNELED_SPELL, m_currentSpells, m_interruptableAuras, m_interruptMask, and SPELL_STATE_CASTING.

Referenced by _UnapplyAura(), Spell::finish(), and RemoveAurasWithInterruptFlags().

◆ UpdateMaxHealth()

virtual void Unit::UpdateMaxHealth ( )
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateMaxPower()

virtual void Unit::UpdateMaxPower ( Powers  power)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ UpdateObjectVisibility()

◆ UpdateOrientation()

void Unit::UpdateOrientation ( float  orientation)

Only server-side orientation update, does not broadcast to client.

19983{
19984 SetOrientation(orientation);
19985 if (IsVehicle())
19987}

References GetVehicleKit(), IsVehicle(), Vehicle::RelocatePassengers(), and Position::SetOrientation().

Referenced by Spell::UpdateChanneledTargetList(), and UpdatePosition().

◆ UpdatePosition() [1/2]

bool Unit::UpdatePosition ( const Position pos,
bool  teleport = false 
)
inline

◆ UpdatePosition() [2/2]

bool Unit::UpdatePosition ( float  x,
float  y,
float  z,
float  ang,
bool  teleport = false 
)
virtual

Reimplemented in Player.

19945{
19946 if (!Acore::IsValidMapCoord(x, y, z, orientation))
19947 return false;
19948
19949 float old_orientation = GetOrientation();
19950 float current_z = GetPositionZ();
19951 bool turn = (old_orientation != orientation);
19952 bool relocated = (teleport || GetPositionX() != x || GetPositionY() != y || current_z != z);
19953
19954 if (!GetVehicle())
19955 {
19956 uint32 mask = 0;
19957 if (turn) mask |= AURA_INTERRUPT_FLAG_TURNING;
19958 if (relocated) mask |= AURA_INTERRUPT_FLAG_MOVE;
19959 if (mask)
19961 }
19962
19963 if (relocated)
19964 {
19965 if (IsPlayer())
19966 GetMap()->PlayerRelocation(ToPlayer(), x, y, z, orientation);
19967 else
19968 GetMap()->CreatureRelocation(ToCreature(), x, y, z, orientation);
19969 }
19970 else if (turn)
19971 {
19972 UpdateOrientation(orientation);
19973
19974 if (IsPlayer() && ToPlayer()->GetFarSightDistance())
19976 }
19977
19978 return (relocated || turn);
19979}
bool IsValidMapCoord(float c)
Definition: GridDefines.h:216
void UpdateOrientation(float orientation)
Only server-side orientation update, does not broadcast to client.
Definition: Unit.cpp:19982
void PlayerRelocation(Player *, float x, float y, float z, float o)
Definition: Map.cpp:1000
void CreatureRelocation(Creature *creature, float x, float y, float z, float o)
Definition: Map.cpp:1022

References AURA_INTERRUPT_FLAG_MOVE, AURA_INTERRUPT_FLAG_TURNING, Map::CreatureRelocation(), WorldObject::GetMap(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetVehicle(), Object::IsPlayer(), Acore::IsValidMapCoord(), Map::PlayerRelocation(), RemoveAurasWithInterruptFlags(), Object::ToCreature(), Object::ToPlayer(), UpdateObjectVisibility(), and UpdateOrientation().

Referenced by npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::DamageTaken(), boss_taldaram::DoAction(), brann_bronzebeard::brann_bronzebeardAI::DoAction(), npc_hor_spiritual_reflection::npc_hor_spiritual_reflectionAI::EnterEvadeMode(), UtherBatteredHiltEvent::Execute(), WorldSession::HandleMovementOpcodes(), WorldSession::HandleMoveRootAck(), WorldSession::HandleMoveUnRootAck(), boss_flame_leviathan::boss_flame_leviathanAI::InitializeAI(), boss_prince_keleseth_icc::boss_prince_kelesethAI::JustDied(), boss_prince_taldaram_icc::boss_prince_taldaramAI::JustDied(), boss_prince_valanar_icc::boss_prince_valanarAI::JustDied(), boss_cyanigosa::boss_cyanigosaAI::JustDied(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_harbinger_skyriss::JustSummoned(), boss_icehowl::boss_icehowlAI::MovementInform(), NearTeleportTo(), npc_ulduar_magnetic_core::npc_ulduar_magnetic_coreAI::npc_ulduar_magnetic_coreAI(), instance_halls_of_reflection::instance_halls_of_reflection_InstanceMapScript::OnCreatureCreate(), instance_culling_of_stratholme::instance_culling_of_stratholme_InstanceMapScript::Reposition(), instance_old_hillsbrad::instance_old_hillsbrad_InstanceMapScript::Reposition(), boss_skadi::boss_skadiAI::Reset(), npc_imprisoned_beryl_sorcerer::npc_imprisoned_beryl_sorcererAI::Reset(), npc_q24545_lich_king::npc_q24545_lich_kingAI::Reset(), npc_escortAI::SetNextWaypoint(), npc_your_inner_turmoil::npc_your_inner_turmoilAI::setphase(), npc_frost_sphere::npc_frost_sphereAI::UpdateAI(), boss_jormungarAI::UpdateAI(), npc_strangulate_vehicle::npc_strangulate_vehicleAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), npc_ulduar_aerial_command_unit::npc_ulduar_aerial_command_unitAI::UpdateAI(), Player::UpdatePosition(), and UpdateSplinePosition().

◆ UpdateReactives()

void Unit::UpdateReactives ( uint32  p_time)
16869{
16870 for (uint8 i = 0; i < MAX_REACTIVE; ++i)
16871 {
16872 ReactiveType reactive = ReactiveType(i);
16873
16874 if (!m_reactiveTimer[reactive])
16875 continue;
16876
16877 if (m_reactiveTimer[reactive] <= p_time)
16878 {
16879 m_reactiveTimer[reactive] = 0;
16880
16881 switch (reactive)
16882 {
16883 case REACTIVE_DEFENSE:
16886 break;
16890 break;
16891 case REACTIVE_OVERPOWER:
16893 {
16895 }
16896 break;
16898 if (IsHunterPet())
16900 break;
16901 default:
16902 break;
16903 }
16904 }
16905 else
16906 {
16907 m_reactiveTimer[reactive] -= p_time;
16908 }
16909 }
16910}
ReactiveType
Definition: Unit.h:587

References AURA_STATE_DEFENSE, AURA_STATE_HUNTER_PARRY, CLASS_CONTEXT_ABILITY_REACTIVE, CLASS_HUNTER, CLASS_WARRIOR, ClearComboPoints(), HasAuraState(), IsClass(), IsHunterPet(), m_reactiveTimer, MAX_REACTIVE, ModifyAuraState(), REACTIVE_DEFENSE, REACTIVE_HUNTER_PARRY, REACTIVE_OVERPOWER, and REACTIVE_WOLVERINE_BITE.

Referenced by Update().

◆ UpdateResistances()

virtual void Unit::UpdateResistances ( uint32  school)
pure virtual

Implemented in Creature, Player, and Totem.

Referenced by HandleStatModifier(), and UpdateAllResistances().

◆ UpdateSpeed()

void Unit::UpdateSpeed ( UnitMoveType  mtype,
bool  forced 
)
Todo:
possible affect only on MOVE_RUN
14180{
14181 int32 main_speed_mod = 0;
14182 float stack_bonus = 1.0f;
14183 float non_stack_bonus = 1.0f;
14184
14185 switch (mtype)
14186 {
14187 // Only apply debuffs
14188 case MOVE_FLIGHT_BACK:
14189 case MOVE_RUN_BACK:
14190 case MOVE_SWIM_BACK:
14191 case MOVE_WALK:
14192 break;
14193 case MOVE_RUN:
14194 {
14195 if (IsMounted()) // Use on mount auras
14196 {
14200 }
14201 else
14202 {
14206 }
14207 break;
14208 }
14209 case MOVE_SWIM:
14210 {
14211 // xinef: check for forced_speed_mod of sea turtle
14213 for (Unit::AuraEffectList::const_iterator itr = swimAuras.begin(); itr != swimAuras.end(); ++itr)
14214 {
14215 // xinef: sea turtle only, it is not affected by any increasing / decreasing effects
14216 if ((*itr)->GetId() == 64731 /*SPELL_SEA_TURTLE*/)
14217 {
14218 SetSpeed(mtype, AddPct(non_stack_bonus, (*itr)->GetAmount()), forced);
14219 return;
14220 }
14221 else if (
14222 // case: increase speed
14223 ((*itr)->GetAmount() > 0 && (*itr)->GetAmount() > main_speed_mod) ||
14224 // case: decrease speed
14225 ((*itr)->GetAmount() < 0 && (*itr)->GetAmount() < main_speed_mod)
14226 )
14227 {
14228 main_speed_mod = (*itr)->GetAmount();
14229 }
14230 }
14231 break;
14232 }
14233 case MOVE_FLIGHT:
14234 {
14235 if (GetTypeId() == TYPEID_UNIT && IsControlledByPlayer()) // not sure if good for pet
14236 {
14239
14240 // for some spells this mod is applied on vehicle owner
14241 int32 owner_speed_mod = 0;
14242
14243 if (Unit* owner = GetCharmer())
14244 owner_speed_mod = owner->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED);
14245
14246 main_speed_mod = std::max(main_speed_mod, owner_speed_mod);
14247 }
14248 else if (IsMounted())
14249 {
14252 }
14253 else // Use not mount (shapeshift for example) auras (should stack)
14255
14257
14258 // Update speed for vehicle if available
14259 if (IsPlayer() && GetVehicle())
14261 break;
14262 }
14263 default:
14264 LOG_ERROR("entities.unit", "Unit::UpdateSpeed: Unsupported move type ({})", mtype);
14265 return;
14266 }
14267
14268 // now we ready for speed calculation
14269 float speed = std::max(non_stack_bonus, stack_bonus);
14270 if (main_speed_mod)
14271 AddPct(speed, main_speed_mod);
14272
14273 switch (mtype)
14274 {
14275 case MOVE_RUN:
14276 case MOVE_SWIM:
14277 case MOVE_FLIGHT:
14278 {
14279 // Set creature speed rate
14280 if (GetTypeId() == TYPEID_UNIT)
14281 {
14282 if (IsPet() && ToPet()->isControlled() && IsControlledByPlayer())
14283 {
14284 // contant value for player pets
14285 speed *= 1.15f;
14286 }
14287 else
14288 {
14289 speed *= ToCreature()->GetCreatureTemplate()->speed_run; // at this point, MOVE_WALK is never reached
14290 }
14291 }
14292
14293 // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
14296 {
14297 if (Creature* creature = ToCreature())
14298 {
14299 uint32 immuneMask = creature->GetCreatureTemplate()->MechanicImmuneMask;
14300 if (immuneMask & (1 << (MECHANIC_SNARE - 1)) || immuneMask & (1 << (MECHANIC_DAZE - 1)))
14301 break;
14302 }
14303
14304 // Use speed from aura
14305 float max_speed = normalization / (IsControlledByPlayer() ? playerBaseMoveSpeed[mtype] : baseMoveSpeed[mtype]);
14306 if (speed > max_speed)
14307 speed = max_speed;
14308 }
14309 break;
14310 }
14311 default:
14312 break;
14313 }
14314
14315 int32 slowFromHealth = 0;
14316 Creature* creature = ToCreature();
14317 // ignore pets, player owned vehicles, and mobs immune to snare
14318 if (creature
14319 && !IsPet()
14320 && !(IsControlledByPlayer() && IsVehicle())
14322 && !(creature->IsDungeonBoss()))
14323 {
14324 // 1.6% for each % under 30.
14325 // use min(0, health-30) so that we don't boost mobs above 30.
14326 slowFromHealth = (int32) std::min(0.0f, (1.66f * (GetHealthPct() - 30.0f)));
14327 }
14328
14329 if (slowFromHealth)
14330 {
14331 AddPct(speed, slowFromHealth);
14332 }
14333
14334 // Apply strongest slow aura mod to speed
14336 if (slow)
14337 AddPct(speed, slow);
14338
14339 if (float minSpeedMod = (float)GetMaxPositiveAuraModifier(SPELL_AURA_MOD_MINIMUM_SPEED))
14340 {
14341 float base_speed = (GetTypeId() == TYPEID_UNIT ? ToCreature()->GetCreatureTemplate()->speed_run : 1.0f);
14342 float min_speed = base_speed * (minSpeedMod / 100.0f);
14343 if (speed < min_speed)
14344 speed = min_speed;
14345 }
14346
14347 SetSpeed(mtype, speed, forced);
14348}
@ SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:274
@ SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
Definition: SpellAuraDefines.h:271
@ SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS
Definition: SpellAuraDefines.h:272
@ SPELL_AURA_MOD_INCREASE_SPEED
Definition: SpellAuraDefines.h:94
@ SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:235
@ SPELL_AURA_MOD_SPEED_NOT_STACK
Definition: SpellAuraDefines.h:234
@ SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED
Definition: SpellAuraDefines.h:269
@ SPELL_AURA_MOD_INCREASE_SWIM_SPEED
Definition: SpellAuraDefines.h:121
@ SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS
Definition: SpellAuraDefines.h:273
@ SPELL_AURA_MOD_MINIMUM_SPEED
Definition: SpellAuraDefines.h:368
@ SPELL_AURA_MOD_SPEED_ALWAYS
Definition: SpellAuraDefines.h:192
@ SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
Definition: SpellAuraDefines.h:193
@ SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
Definition: SpellAuraDefines.h:95
@ SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
Definition: SpellAuraDefines.h:254
@ MECHANIC_DAZE
Definition: SharedDefines.h:1352
float speed_run
Definition: CreatureData.h:204
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14355

References AddPct(), baseMoveSpeed, GetAuraEffectsByType(), GetCharmer(), Creature::GetCreatureTemplate(), GetHealthPct(), GetMaxNegativeAuraModifier(), GetMaxPositiveAuraModifier(), GetTotalAuraModifier(), GetTotalAuraMultiplier(), Object::GetTypeId(), GetVehicle(), GetVehicleBase(), Creature::HasMechanicTemplateImmunity(), IsControlledByPlayer(), Creature::IsDungeonBoss(), IsMounted(), IsPet(), Object::IsPlayer(), IsVehicle(), LOG_ERROR, MECHANIC_DAZE, MECHANIC_SNARE, MOVE_FLIGHT, MOVE_FLIGHT_BACK, MOVE_RUN, MOVE_RUN_BACK, MOVE_SWIM, MOVE_SWIM_BACK, MOVE_WALK, playerBaseMoveSpeed, SetSpeed(), CreatureTemplate::speed_run, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK, SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED, SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED, SPELL_AURA_MOD_INCREASE_SPEED, SPELL_AURA_MOD_INCREASE_SWIM_SPEED, SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED, SPELL_AURA_MOD_MINIMUM_SPEED, SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS, SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK, SPELL_AURA_MOD_SPEED_ALWAYS, SPELL_AURA_MOD_SPEED_NOT_STACK, SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS, SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED, Object::ToCreature(), ToPet(), TYPEID_UNIT, and UpdateSpeed().

Referenced by Creature::DoFleeToGetAssistance(), AuraEffect::HandleAuraModDecreaseSpeed(), AuraEffect::HandleAuraModIncreaseFlightSpeed(), AuraEffect::HandleAuraModIncreaseSpeed(), AuraEffect::HandleAuraModIncreaseSwimSpeed(), AuraEffect::HandleAuraModUseNormalSpeed(), spell_brewfest_main_ram_buff::HandleEffectPeriodic(), RemoveCharmedBy(), SetHealth(), SetInCombatState(), SetSpeed(), and UpdateSpeed().

◆ UpdateSplineMovement()

void Unit::UpdateSplineMovement ( uint32  t_diff)
private
577{
578 if (movespline->Finalized())
579 return;
580
581 // xinef: process movementinform
582 // this code cant be placed inside EscortMovementGenerator, because we cant delete active MoveGen while it is updated
583 SplineHandler handler(this);
584 movespline->updateState(t_diff, handler);
585 // Xinef: Spline was cleared by StopMoving, return
586 if (!movespline->Initialized())
587 {
589 return;
590 }
591
592 bool arrived = movespline->Finalized();
593
594 if (arrived)
595 {
597
600 }
601
602 // pussywizard: update always! not every 400ms, because movement generators need the actual position
603 //m_movesplineTimer.Update(t_diff);
604 //if (m_movesplineTimer.Passed() || arrived)
606}
@ UNIT_BYTES_1_OFFSET_ANIM_TIER
Definition: UnitDefines.h:26
Definition: Unit.cpp:556
uint8 GetAnimationType() const
Definition: MoveSpline.h:125
void updateState(int32 difftime, UpdateHandler &handler)
Definition: MoveSpline.h:98
bool HasAnimation() const
Definition: MoveSpline.h:124

References DisableSpline(), Movement::MoveSpline::Finalized(), Movement::MoveSpline::GetAnimationType(), Object::GetTypeId(), Movement::MoveSpline::HasAnimation(), Movement::MoveSpline::Initialized(), IsAlive(), movespline, Object::SetByteValue(), TYPEID_UNIT, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_FIELD_BYTES_1, UpdateSplinePosition(), and Movement::MoveSpline::updateState().

Referenced by Update().

◆ UpdateSplinePosition()

void Unit::UpdateSplinePosition ( )
private
609{
610 //static uint32 const positionUpdateDelay = 400;
611
612 //m_movesplineTimer.Reset(positionUpdateDelay);
614
616 {
618 pos.m_positionX = loc.x;
619 pos.m_positionY = loc.y;
620 pos.m_positionZ = loc.z;
622
623 if (TransportBase* transport = GetDirectTransport())
624 transport->CalculatePassengerPosition(loc.x, loc.y, loc.z, &loc.orientation);
625 }
626
627 // Xinef: if we had spline running update orientation along with position
628 //if (HasUnitState(UNIT_STATE_CANNOT_TURN))
629 // loc.orientation = GetOrientation();
630
631 if (IsPlayer())
632 UpdatePosition(loc.x, loc.y, loc.z, loc.orientation);
633 else
634 ToCreature()->SetPosition(loc.x, loc.y, loc.z, loc.orientation);
635}
void SetPosition(float x, float y, float z, float o)
Definition: Creature.cpp:3140
Position pos
Definition: Object.h:295
float m_positionZ
Definition: Position.h:58
float m_positionX
Definition: Position.h:56
float m_positionY
Definition: Position.h:57
TransportBase * GetDirectTransport() const
Returns the transport this unit is on directly (if on vehicle and transport, return vehicle)
Definition: Unit.cpp:18684
Definition: VehicleDefines.h:106
Definition: MoveSpline.h:27
float orientation
Definition: MoveSpline.h:33
Location ComputePosition() const
Definition: MoveSpline.cpp:26
bool onTransport
Definition: MoveSpline.h:127

References Movement::MoveSpline::ComputePosition(), GetDirectTransport(), Object::IsPlayer(), WorldObject::m_movementInfo, Position::m_positionX, Position::m_positionY, Position::m_positionZ, movespline, Movement::MoveSpline::onTransport, Movement::Location::orientation, MovementInfo::TransportInfo::pos, Position::SetOrientation(), Creature::SetPosition(), Object::ToCreature(), MovementInfo::transport, and UpdatePosition().

Referenced by StopMoving(), and UpdateSplineMovement().

◆ UpdateStats()

virtual bool Unit::UpdateStats ( Stats  stat)
pure virtual

Implemented in Creature, Guardian, Player, and Totem.

Referenced by HandleStatModifier().

◆ Whisper() [1/2]

void Unit::Whisper ( std::string_view  text,
Language  language,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

21058{
21059 if (!target)
21060 {
21061 return;
21062 }
21063
21065 WorldPacket data;
21066 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, language, this, target, text, 0, "", locale);
21067 target->SendDirectMessage(&data);
21068}
@ CHAT_MSG_MONSTER_WHISPER
Definition: SharedDefines.h:3167
@ CHAT_MSG_RAID_BOSS_WHISPER
Definition: SharedDefines.h:3194
LocaleConstant
Definition: Common.h:64
static std::size_t BuildChatPacket(WorldPacket &data, ChatMsg chatType, Language language, ObjectGuid senderGUID, ObjectGuid receiverGUID, std::string_view message, uint8 chatTag, std::string const &senderName="", std::string const &receiverName="", uint32 achievementId=0, bool gmMessage=false, std::string const &channelName="")
Definition: Chat.cpp:267
LocaleConstant GetSessionDbLocaleIndex() const
Definition: WorldSession.h:498

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), and Player::SendDirectMessage().

Referenced by npc_commandscript::HandleNpcWhisperCommand(), Map::ScriptsProcess(), and boss_zuramat::boss_zuramatAI::UpdateAI().

◆ Whisper() [2/2]

void Unit::Whisper ( uint32  textId,
Player target,
bool  isBossWhisper = false 
)
virtual

Reimplemented in Player.

21100{
21101 if (!target)
21102 {
21103 return;
21104 }
21105
21106 BroadcastText const* bct = sObjectMgr->GetBroadcastText(textId);
21107 if (!bct)
21108 {
21109 LOG_ERROR("entities.unit", "Unit::Whisper: `broadcast_text` was not {} found", textId);
21110 return;
21111 }
21112
21114 WorldPacket data;
21115 ChatHandler::BuildChatPacket(data, isBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, bct->GetText(locale, getGender()), 0, "", locale);
21116 target->SendDirectMessage(&data);
21117}
Definition: ObjectMgr.h:435
std::string const & GetText(LocaleConstant locale=DEFAULT_LOCALE, uint8 gender=GENDER_MALE, bool forceGender=false) const
Definition: ObjectMgr.h:457

References ChatHandler::BuildChatPacket(), CHAT_MSG_MONSTER_WHISPER, CHAT_MSG_RAID_BOSS_WHISPER, getGender(), Player::GetSession(), WorldSession::GetSessionDbLocaleIndex(), BroadcastText::GetText(), LANG_UNIVERSAL, LOG_ERROR, Player::SendDirectMessage(), and sObjectMgr.

◆ Yell() [1/2]

void Unit::Yell ( std::string_view  text,
Language  language,
WorldObject const *  target = nullptr 
)
virtual

◆ Yell() [2/2]

void Unit::Yell ( uint32  textId,
WorldObject const *  target = nullptr 
)
virtual

Reimplemented in Player.

21090{
21091 Talk(textId, CHAT_MSG_MONSTER_YELL, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL), target);
21092}

References CHAT_MSG_MONSTER_YELL, CONFIG_LISTEN_RANGE_YELL, and sWorld.

Member Data Documentation

◆ _charmThreatInfo

CharmThreatMap Unit::_charmThreatInfo
protected

Referenced by RemoveCharmedBy().

◆ _instantCast

bool Unit::_instantCast
protected

◆ _isWalkingBeforeCharm

bool Unit::_isWalkingBeforeCharm
private

Are we walking before we were charmed?

Referenced by SetCharm(), and Unit().

◆ _lastDamagedTargetGuid

◆ _lastExtraAttackSpell

uint32 Unit::_lastExtraAttackSpell
private

◆ _lastLiquid

LiquidTypeEntry const* Unit::_lastLiquid
protected

◆ _oldFactionId

uint32 Unit::_oldFactionId
private

faction before charm

Referenced by GetOldFactionId(), RemoveCharmedBy(), SetCharmedBy(), and Unit().

◆ _redirectThreatInfo

◆ _valuesUpdateCache

ValuesUpdateCache Unit::_valuesUpdateCache
private

◆ bRequestForcedVisibilityUpdate

◆ extraAttacksTargets

std::unordered_map<ObjectGuid , uint32 > Unit::extraAttacksTargets
private

Referenced by AddExtraAttacks(), and Update().

◆ i_AI

◆ i_disabledAI

UnitAI * Unit::i_disabledAI
protected

Referenced by UpdateCharmAI().

◆ i_motionMaster

MotionMaster* Unit::i_motionMaster
protected

Referenced by GetMotionMaster(), and ~Unit().

◆ IsAIEnabled

◆ m_appliedAuras

◆ m_applyResilience

bool Unit::m_applyResilience
protected

◆ m_attackers

◆ m_attacking

Unit* Unit::m_attacking
protected

◆ m_attackTimer

◆ m_auraModifiersGroup

◆ m_auraStateAuras

◆ m_auraUpdateIterator

AuraMap::iterator Unit::m_auraUpdateIterator
protected

◆ m_AutoRepeatFirstCast

bool Unit::m_AutoRepeatFirstCast
protected

◆ m_baseSpellCritChance

◆ m_canDualWield

bool Unit::m_canDualWield

◆ m_canModifyStats

bool Unit::m_canModifyStats
protected

◆ m_charmInfo

◆ m_cleanupDone

bool Unit::m_cleanupDone
private

◆ m_CombatTimer

uint32 Unit::m_CombatTimer
private

◆ m_ComboPointHolders

std::unordered_set<Unit*> Unit::m_ComboPointHolders
private

◆ m_comboPoints

int8 Unit::m_comboPoints
private

◆ m_comboTarget

◆ m_Controlled

◆ m_ControlledByPlayer

bool Unit::m_ControlledByPlayer

◆ m_CreatedByPlayer

bool Unit::m_CreatedByPlayer

◆ m_createStats

float Unit::m_createStats[MAX_STATS]
protected

◆ m_currentSpells

◆ m_deathState

◆ m_delayed_unit_ai_notify_timer

uint16 Unit::m_delayed_unit_ai_notify_timer

Referenced by Unit(), and Update().

◆ m_delayed_unit_relocation_timer

uint16 Unit::m_delayed_unit_relocation_timer

Referenced by Unit(), Player::Update(), and Update().

◆ m_Diminishing

◆ m_duringRemoveFromWorld

bool Unit::m_duringRemoveFromWorld
private

◆ m_dynObj

◆ m_Events

EventProcessor Unit::m_Events

Referenced by _ExitVehicle(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::Activate(), CharmInfo::AddSpellToActionBar(), Spell::AddUnitTarget(), spell_sindragosa_ice_tomb_trap_aura::AfterApply(), Creature::CallAssistance(), CastDelayedSpellWithPeriodicAmount(), boss_murmur::CastSupressionOOC(), CleanupBeforeRemoveFromMap(), boss_romulo::DamageTaken(), boss_the_lich_king::boss_the_lich_kingAI::DamageTaken(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::DoAction(), boss_julianne::DoAction(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::DoAction(), boss_prince_keleseth_icc::boss_prince_kelesethAI::DoAction(), boss_prince_taldaram_icc::boss_prince_taldaramAI::DoAction(), boss_prince_valanar_icc::boss_prince_valanarAI::DoAction(), boss_sindragosa::boss_sindragosaAI::DoAction(), npc_spinestalker::npc_spinestalkerAI::DoAction(), npc_rimefang::npc_rimefangAI::DoAction(), npc_green_dragon_combat_trigger::npc_green_dragon_combat_triggerAI::DoAction(), boss_cthun::DoAction(), boss_ouro::Emerge(), SpellEvent::Execute(), BattleExperienceEvent::Execute(), UtherBatteredHiltEvent::Execute(), TriggerWickedSpirit::Execute(), lapseTeleport::Execute(), PartyTimeEmoteEvent::Execute(), npc_xt002_boombot::npc_xt002_boombotAI::Explode(), Creature::ForcedDespawn(), WorldSession::HandleAuctionListOwnerItems(), spell_item_party_time::HandleEffectApply(), spell_alar_flame_quills::HandlePeriodic(), spell_ayamiss_swarmer_teleport_trigger::HandleScript(), boss_ambassador_hellmaw::InitializeAI(), npc_pet_mage_mirror_image::InitializeAI(), Totem::InitSummon(), npc_swarm_scarab::npc_swarm_scarabAI::JustDied(), npc_nerubian_burrower::npc_nerubian_burrowerAI::JustDied(), npc_gunship::npc_gunshipAI::JustDied(), npc_xt002_boombot::npc_xt002_boombotAI::JustDied(), npc_q24545_wretched_ghoul::npc_q24545_wretched_ghoulAI::JustDied(), boss_essence_of_suffering::boss_essence_of_sufferingAI::JustEngagedWith(), boss_swamplord_muselek::JustEngagedWith(), boss_murmur::JustEngagedWith(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::JustEngagedWith(), boss_mother_shahraz::JustEngagedWith(), boss_najentus::JustEngagedWith(), boss_hydross_the_unstable::JustEngagedWith(), boss_kiljaeden::boss_kiljaedenAI::JustSummoned(), boss_hazzarah::JustSummoned(), boss_baltharus_the_warborn::boss_baltharus_the_warbornAI::JustSummoned(), boss_drakkari_colossus::boss_drakkari_colossusAI::JustSummoned(), boss_prince_valanar_icc::boss_prince_valanarAI::JustSummoned(), boss_sindragosa::boss_sindragosaAI::JustSummoned(), boss_the_lich_king::boss_the_lich_kingAI::JustSummoned(), boss_valithria_dreamwalker::boss_valithria_dreamwalkerAI::JustSummoned(), npc_risen_archmage::npc_risen_archmageAI::JustSummoned(), boss_algalon_the_observer::boss_algalon_the_observerAI::JustSummoned(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::JustSummoned(), boss_gurtogg_bloodboil::boss_gurtogg_bloodboilAI::KilledUnit(), boss_essence_of_suffering::boss_essence_of_sufferingAI::KilledUnit(), boss_essence_of_desire::boss_essence_of_desireAI::KilledUnit(), boss_essence_of_anger::boss_essence_of_angerAI::KilledUnit(), Creature::ModifyThreatPercentTemp(), boss_ebonroc::boss_ebonrocAI::MovementInform(), boss_captain_skarloc::MovementInform(), boss_ayamiss::MovementInform(), boss_essence_of_suffering::boss_essence_of_sufferingAI::MovementInform(), boss_essence_of_desire::boss_essence_of_desireAI::MovementInform(), npc_kalecgos::MovementInform(), gunship_npc_AI::MovementInform(), npc_gunship_boarding_addAI::MovementInform(), boss_ghazan::MovementInform(), spell_halion_twilight_realm_aura::OnApply(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnCreatureCreate(), go_main_chambers_access_panel::OnGossipHello(), spell_halion_leave_twilight_realm_aura::OnRemove(), at_cthun_stomach_exit::OnTrigger(), instance_icecrown_citadel::instance_icecrown_citadel_InstanceMapScript::OnUnitDeath(), npc_hyldsmeet_protodrake::npc_hyldsmeet_protodrakeAI::PassengerBoarded(), boss_anetheron::PathEndReached(), boss_rage_winterchill::PathEndReached(), npc_hyjal_ground_trash::PathEndReached(), npc_hyjal_frost_wyrm::PathEndReached(), boss_ambassador_hellmaw::PathEndReached(), npc_hyjal_gargoyle::PathEndReached(), npc_hive_zara_swarmer::PathEndReached(), boss_reliquary_of_souls::boss_reliquary_of_soulsAI::PhaseTransitionSpawns(), Spell::prepare(), SmartScript::ProcessAction(), Spell::RecalculateDelayMomentForDst(), boss_runemaster_molgeim::boss_runemaster_molgeimAI::Reset(), boss_mother_shahraz::Reset(), boss_najentus::Reset(), NPCStaveQuestAI::ResetState(), npc_gunship_boarding_addAI::SetData(), boss_the_beast::boss_thebeastAI::SetData(), npc_highlord_darion_mograine::npc_highlord_darion_mograineAI::SummonedCreatureDies(), boss_hydross_the_unstable::SummonMovementInform(), boss_hydross_the_unstable::SummonTaintedElementalOOC(), CreatureAI::Talk(), TempSummon::UnSummon(), Totem::UnSummon(), spell_illidari_council_deadly_strike_aura::Update(), Update(), boss_felmyst::boss_felmystAI::UpdateAI(), and boss_anomalus::boss_anomalusAI::UpdateAI().

◆ m_extraAttacks

uint32 Unit::m_extraAttacks

◆ m_FollowingRefMgr

FollowerRefMgr Unit::m_FollowingRefMgr
private

Referenced by addFollower().

◆ m_gameObj

◆ m_HostileRefMgr

HostileRefMgr Unit::m_HostileRefMgr
private

◆ m_interruptableAuras

◆ m_interruptMask

◆ m_last_notify_mstime

uint32 Unit::m_last_notify_mstime

◆ m_last_notify_position

◆ m_lastManaUse

uint32 Unit::m_lastManaUse
private

◆ m_lastSanctuaryTime

uint32 Unit::m_lastSanctuaryTime

◆ m_modAttackSpeedPct

◆ m_modAuras

◆ m_modMeleeHitChance

◆ m_modRangedHitChance

◆ m_modSpellHitChance

◆ m_movedByPlayer

◆ m_ObjectSlot

◆ m_ownedAuras

◆ m_petAuras

PetAuraSet Unit::m_petAuras

◆ m_procDeep

int32 Unit::m_procDeep
protected

Referenced by CanProc(), and SetCantProc().

◆ m_race

uint8 Unit::m_race
protected

◆ m_reactiveTimer

uint32 Unit::m_reactiveTimer[MAX_REACTIVE]
protected

◆ m_realRace

uint8 Unit::m_realRace
protected

◆ m_regenTimer

◆ m_removedAuras

AuraList Unit::m_removedAuras
protected

◆ m_removedAurasCount

uint32 Unit::m_removedAurasCount
protected

◆ m_rootTimes

uint32 Unit::m_rootTimes
protected

Referenced by SetRooted(), and Unit().

◆ m_scAuras

AuraList Unit::m_scAuras
protected

Referenced by GetSingleCastAuras().

◆ m_sharedVision

◆ m_speed_rate

float Unit::m_speed_rate[MAX_MOVE_TYPE]
protected

◆ m_spellImmune

◆ m_state

uint32 Unit::m_state
private

◆ m_SummonSlot

◆ m_ThreatMgr

◆ m_threatModifier

float Unit::m_threatModifier[MAX_SPELL_SCHOOL]

◆ m_transform

uint32 Unit::m_transform
protected

Referenced by getTransForm(), setTransForm(), and Unit().

◆ m_unitTypeMask

◆ m_vehicle

◆ m_vehicleKit

Vehicle* Unit::m_vehicleKit
protected

◆ m_visibleAuras

◆ m_weaponDamage

◆ movespline

◆ NeedChangeAI

bool Unit::NeedChangeAI

◆ SafeUnitPointerSet

std::set<SafeUnitPointer*> Unit::SafeUnitPointerSet